From a9b57542a658cffddbc3517f2dec696bcb60a1c9 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 1 Jul 2018 23:08:39 +0300 Subject: add page turn handling for iframe margins --- js/reader.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'js/reader.js') 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(); }); -- cgit v1.2.3