View Single Post
Old 09-28-2015, 03:01 PM   #5
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,736
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
I only have rudimentary JavaScript skills, but I believe that your code probably doesn't work because you forgot to make sure that the page was fully loaded before the script is run. Since I was too lazy to search for a pure JavaScript solution, I simply used jQuery to check the ready state:

Code:
 $(document).ready(function() {
    window.frames["f1"].addEventListener("resize", setup);
  });
I plugged your slightly modified code into the ePub3 wrapper of the file that I attached to the second post and it appears to be working with ADE 4.5 but pretty much nothing else.

BTW, if you want to create a valid epub, you can't use position: absolute; in the CSS. epubcheck will also complain about the name attribute; use id instead. (The attached file will pass epubcheck 4.)

IMHO, you'd be better off looking for a pure CSS solution. Since you're apparently interested in fleurons, have a look at the ::after pseudo selector. Maybe you could manipulate its CSS rule to achieve the desired result.
Attached Files
File Type: epub JavaScriptTest.epub (62.0 KB, 384 views)
Doitsu is offline   Reply With Quote