FInding out when page is being viewed in EPUB FXL via Javascript

*爱你&永不变心* 提交于 2019-12-22 11:21:06

问题


Is it possible to find out when a page of an EPUB Fixed Layout is being viewed with Javascript?

There is the DOMContentLoaded event, but the adjacent pages also fire this event when they are preloaded in iBooks, causing animations or sounds to start before the page being visible...


回答1:


No, it's not.

This is a "feature" of iBooks. It preloads the pages, I suppose to make page turns faster later on. Unfortunately, there is no way to detect that a page is preloading as opposed to being actually viewed.

There's only one way to deal with this--force user interaction on each page (tapping something) to start the animations or sounds. You may even need to structure your JS so that the JS itself is not loaded until the user interaction occurs. Videos won't start playing without user interaction anyway.



来源:https://stackoverflow.com/questions/15483574/finding-out-when-page-is-being-viewed-in-epub-fxl-via-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!