summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-07-01 23:19:11 +0300
committerAndrew Dolgov <[email protected]>2018-07-01 23:19:11 +0300
commitb78ba7f3d0177568991514d111ed70b5760cdabb (patch)
treea4e60afd7b2b00b99a802256e04d021272c15e95
parent577844e0568fb31c82a2071262315752037e7f87 (diff)
Revert "Revert "add page turn handling for iframe margins""
This reverts commit 577844e0568fb31c82a2071262315752037e7f87.
-rw-r--r--js/reader.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/js/reader.js b/js/reader.js
index 255ee91..e0572aa 100644
--- a/js/reader.js
+++ b/js/reader.js
@@ -23,6 +23,26 @@ $(document).ready(function() {
}
});
+ $(window).on("mouseup", function(evt) {
+ if (evt.button == 0) {
+
+ if ($(".modal").is(":visible"))
+ return;
+
+ var reader = $("body");
+ var doc = document.documentElement;
+ var margin_side = parseInt(reader.css("padding-left"), 10);
+
+ if (evt.clientX >= doc.clientWidth - margin_side) {
+ console.log("iframe: RIGHT SIDE");
+ parent.next_page();
+ } else if (evt.clientX <= margin_side) {
+ console.log("iframe: LEFT SIDE");
+ parent.prev_page();
+ }
+ }
+ });
+
$(window).on("touchstart", function() {
enable_swipes();
});