epub 3, how to prevent pages from running in backg

2019-05-26 20:48发布

I have created and validated an ePub 3 which I am currently testing. I am using a fixed layout..

<meta property="rendition:layout">pre-paginated</meta>
<meta property="rendition:orientation">portrait</meta>
<meta property="rendition:spread">none< /meta> 

It works nicely, however multiple pages seems to load and run at once when testing in different readers. I'm using jQuery's document ready to kick things off and play audio, run animations, etc.

When testing in iBooks I open the book to page 1 which loads and begins to run, but then I start hearing audio from page 2.. so the document ready function has fired for page 2 (because it has been loaded) even though I am not viewing it yet. In Readium it seems load and run every single page...

Three questions:

  1. Does anyone know why?

  2. Is there a way to prevent an eReader from running or loading pages you are currently not viewing?

  3. Is there a way to detect (with javascript) when a page is being viewed? (I have tried adding focus event listener to the window but it didn't work).

2条回答
在下西门庆
2楼-- · 2019-05-26 21:29

The problem is in Redium. you should manually set the settings to make it as two page.

into the Redium, go to settings then check the double pages

查看更多
Rolldiameter
3楼-- · 2019-05-26 21:40

Document ready seems not to work in ePub. After testing a bit, I noticed that my javascript did not wait my document is ready to start its work. I tested on iPad 1 (iOS 5.1.1) with 3.1 iBooks version. The "solution" I have is to estimate the loading time of your HTML document by any tool which does this, then multiply it by 2 or 3 (because javascript on iOS device is clearly as slow) and use settimeout() function with the obtained time.

查看更多
登录 后发表回答