summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-05-01 17:23:08 +0300
committerAndrew Dolgov <[email protected]>2018-05-01 17:23:08 +0300
commit38a03bd23b0e9e8a63cd81130cdd70a55d3f907d (patch)
tree74e568f6d960bda54005f728bf5129732d0b7fde /js
parent76760cffe09083f31e51e81a3ec121c15b2126fc (diff)
another attempt at smarter swipe behavior
Diffstat (limited to 'js')
-rw-r--r--js/reader.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/js/reader.js b/js/reader.js
index 34c5e06..26705d6 100644
--- a/js/reader.js
+++ b/js/reader.js
@@ -1,5 +1,17 @@
'use strict';
+function enable_swipes() {
+ $(window).off("swipeleft swiperight");
+
+ $(window).on("swipeleft", function() {
+ parent.book.nextPage();
+ });
+
+ $(window).on("swiperight", function() {
+ parent.book.prevPage();
+ });
+}
+
$(document).ready(function() {
$(window).on("click tap", function() {
if (parent.$(".header").is(":visible")) {
@@ -10,5 +22,15 @@ $(document).ready(function() {
parent.disable_fullscreen();
}
});
+
+ $(window).on("touchstart", function() {
+ enable_swipes();
+ });
+
+ $(window).on("mousedown", function() {
+ $(window).off("swipeleft swiperight");
+ });
+
+ enable_swipes();
});