javascript - Current Reading Position and Progress in iBooks with js -
i'm trying calculate current reading position , reading progress of epub opened in ibooks. in other reading systems (like readium or adobe rmsdk) position of content relative viewport can use
var firstrect = nodes[0].getboundingclientrect(); var lastrect = nodes[nodes.length- 1].getboundingclientrect();
so can calculate progress like
var progress=firstrect.left+lastrect.left>0?math.round(math.abs(firstrect.left*100)/(math.abs(firstrect.left)+lastrect.left)):100;
although ibooks webkit based , allows use of js compliant epub3 standard - position of rects not change when content scrolled in ibooks view, i.e. stays same.
i'm stuck here. thoughts?
i want integrate functionality open source library epubtrack.js
Comments
Post a Comment