質問

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

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top