Scrolling to where an element is, using location.href or otherwise

2 posts / 0 new
Last post

My book has some interactivity which involves jumping to a different page (within the same file).
In other readers, I do this by setting location.hash ='#id', and it works fine.
Readium does not respond to the location.hash setting.

I've also experimented with finding the physical location in pixel terms I want to go to, and scrolling there using things like window.scrollTo. This does not work either. Nor does scrollIntoView, not surprisingly since I believe that's vertical scrolling.

I have found that Readium appears to handle page placement using the CSS "left" property on the HTML element within the iframe, and I can manipulate that to move to a different page, but Readium remembers what page it "thinks" it's on so subsequent moves to next or previous page move to the page before or after the one Readium thinks its on, not the one I put it on with "left".

In any case, deciding what to do is complicated by the fact that I can't see a navigator.epubReadingSystem object, and therefore have no reliable way to even tell if the book is being read in Readium or not.

I could dig into the Radium code and try playing with things like Readium.Models.EPUBController.goToHref, but I'm wary of using things that could change in the future.

Anyway, thoughts on how to move between pages in Readium?

Anybody home?

Secondary menu