nextPage() only renders the first page of the chapter

434 views
Skip to first unread message

David Asher

unread,
Oct 8, 2014, 10:25:20 AM10/8/14
to epu...@googlegroups.com
I'm loading epub.js into the Android webview - works beautifully. In the iOS webview, calling nextPage() will only render the first page in the chapter. I can see from the cfi that the call works and the page is changing, but the rendering is stuck on the first page. If you call nextPage() enough times, eventually you get to the first page of the next chapter.

Has anyone seen this problem? Any ideas to fix it or work around it?

Thanks,
David

Fred Chasen

unread,
Oct 8, 2014, 1:22:59 PM10/8/14
to epu...@googlegroups.com
Two things to do that should fix this for mobile webkit, which can be found in more detail here: https://github.com/futurepress/epub.js/issues/162
Still looking into how to do this automatically.

1) Set a width and height, so it doesn't auto expand

book = ePub("/path/to/book/, { width: 320, height: 400 });


or with css

 /*For iPad landscape layouts only */
@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation: landscape) {
   
#viewer iframe {
       
width: 460px;
       
height: 415px;
   
}
}

2) Override the setLeft function to not use scrolling

EPUBJS.Render.Iframe.prototype.setLeft = function(leftPos){
   
this.docEl.style["-webkit-transform"] = 'translate('+ (-leftPos) + 'px, 0)';
};

David Asher

unread,
Oct 8, 2014, 3:55:49 PM10/8/14
to epu...@googlegroups.com
setLeft worked perfectly, thanks!
Reply all
Reply to author
Forward
0 new messages