epub 3,如何防止页面在后台运行? (iBooks/Readium) [英] epub 3, how to prevent pages from running in background ? (iBooks / Readium)

查看:92
本文介绍了epub 3,如何防止页面在后台运行? (iBooks/Readium)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建并验证了我目前正在测试的ePub 3.我使用的是固定布局.

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> 

它工作得很好,但是在不同的阅读器中进行测试时,似乎可以一次加载并运行多个页面.我正在使用jQuery的文档,准备开始工作并播放音频,运行动画等.

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.

在iBooks中进行测试时,我将书打开到第1页并加载并开始运行,但随后我开始从第2页开始收听音频.因此,即使第2页的文档就绪功能也已触发(因为已加载)尽管我尚未查看.在Readium中,似乎加载并运行了每个页面...

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...

三个问题:

  1. 有人知道为什么吗?

  1. Does anyone know why?

是否可以防止电子阅读器运行或加载您当前未查看的页面?

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

有没有一种方法可以检测(正在使用javascript)查看页面的时间? (我曾尝试将焦点事件侦听器添加到窗口中,但没有用).

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).

推荐答案

文档就绪似乎无法在ePub中使用.经过一些测试,我注意到我的javascript没有等待我的文档准备开始工作.我在iPad 3.1(iOS 5.1.1)上使用3.1 iBooks版本进行了测试.我拥有的解决方案"是通过执行此操作的任何工具来估算HTML文档的加载时间,然后将其乘以2或3(因为iOS设备上的javascript显然很慢),然后将settimeout()函数与时间.

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.

这篇关于epub 3,如何防止页面在后台运行? (iBooks/Readium)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆