diff --git a/Source/Resources/Bridge.js b/Source/Resources/Bridge.js index 363fa5908..7305882e0 100755 --- a/Source/Resources/Bridge.js +++ b/Source/Resources/Bridge.js @@ -235,6 +235,18 @@ function goToEl(el) { if(elBottom > bottom || elTop < top) { document.body.scrollTop = el.offsetTop - 20 } + + /* Set scroll left in case horz scroll is activated. + + The following works because el.offsetTop accounts for each page turned + as if the document was scrolling vertical. We then divide by the window + height to figure out what page the element should appear on and set scroll left + to scroll to that page. + */ + if( document.body.scrollTop == 0 ){ + var elLeft = document.body.clientWidth * Math.floor(el.offsetTop / window.innerHeight); + document.body.scrollLeft = elLeft; + } return el; }