diff --git a/r2-streamer-swift/Resources/scripts/utils.js b/r2-streamer-swift/Resources/scripts/utils.js index 58345291..aea57d43 100644 --- a/r2-streamer-swift/Resources/scripts/utils.js +++ b/r2-streamer-swift/Resources/scripts/utils.js @@ -8,7 +8,10 @@ var readium = (function() { window.addEventListener("load", function(){ // on page load // Notify native code that the page is loaded. webkit.messageHandlers.didLoad.postMessage(""); - window.addEventListener("orientationchange", orientationChanged); + window.addEventListener("orientationchange", function() { + orientationChanged(); + snapCurrentPosition(); + }); orientationChanged(); }, false); @@ -37,7 +40,6 @@ var readium = (function() { function orientationChanged() { maxScreenX = (window.orientation === 0 || window.orientation == 180) ? screen.width : screen.height; - snapCurrentPosition(); } function isScrollModeEnabled() { @@ -122,6 +124,9 @@ var readium = (function() { } function snapCurrentPosition() { + if (isScrollModeEnabled()) { + return; + } var currentOffset = window.scrollX; var currentOffsetSnapped = snapOffset(currentOffset + 1);