summaryrefslogtreecommitdiff
path: root/js/reader.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-07-01 23:08:39 +0300
committerAndrew Dolgov <[email protected]>2018-07-01 23:08:39 +0300
commita9b57542a658cffddbc3517f2dec696bcb60a1c9 (patch)
treea4e60afd7b2b00b99a802256e04d021272c15e95 /js/reader.js
parentf88d911c02715f66dc56c31c4ef2c72ac3ba4eb8 (diff)
add page turn handling for iframe margins
Diffstat (limited to 'js/reader.js')
-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();
});