1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-04 15:09:16 +02:00

remove any uses of offsetLeft, cleaned up storage

This commit is contained in:
Fred Chasen 2013-03-27 15:56:11 -07:00
parent 7f41f00775
commit 5d7a15eabd
14 changed files with 102 additions and 72 deletions

View file

@ -303,11 +303,9 @@ FP.Chapter.prototype.section = function(fragment){
var el = this.doc.getElementById(fragment),
left, pg;
if(el){
left = this.leftPos + el.offsetLeft, //-- Calculate left offset compaired to scrolled position
left = this.leftPos + el.getBoundingClientRect().left, //-- Calculate left offset compaired to scrolled position
pg = Math.floor(left / this.spreadWidth) + 1; //-- pages start at 1
this.page(pg);
}