2

I wrote a little script in JavaScript that allows the user to switch the language of the text displayed. It simply works by hiding the language blocks except for the one corresponding to the language requested.

The problem is that the first block may fit in a single page while the second spans over two pages, and iBooks doesn't notice the length of the content has changed, and the longer block gets truncated.

How to tell iBooks the content has changed to force re-calculating pagination and show as many pages as needed by the newly visible block?

  • The answer to you question will depend on figuring out what events force iBooks to recalculate pagination. iBooks does re-paginate on certain user-initiated events (changing the font or the text size from the app settings, for example), but I don't know if it pays attention to ebook events, and if so what events it re-paginates for. What method are you using to hide and show blocks? CSS display: none properties? What else have you tried so far? Have you tried making changes to the DOM with your script (like adding an element or changing the inner HTML of an existing element)? – blendenzo Sep 11 '17 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.