summaryrefslogtreecommitdiff
path: root/js/reader.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-02-26 13:28:58 +0300
committerAndrew Dolgov <[email protected]>2018-02-26 13:28:58 +0300
commit82e821c5b5495b8c9fc1e15cb11e3bbd5438eb36 (patch)
tree22589d060c3c5cfdac024a6e771306c464ca7836 /js/reader.js
parentade92000ea4c7b05503211623b1672dc0c4b2ff1 (diff)
exp workaround: enable swipes after first touch event
Diffstat (limited to 'js/reader.js')
-rw-r--r--js/reader.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/js/reader.js b/js/reader.js
index 453c925..108f1a4 100644
--- a/js/reader.js
+++ b/js/reader.js
@@ -1,5 +1,19 @@
+function setup_swipes() {
+ $(window).off("swipeleft swiperight");
+
+ if (parent._has_touch) {
+ $(window).on("swiperight", function() {
+ parent.prev_page();
+ });
+
+ $(window).on("swipeleft", function() {
+ parent.next_page();
+ });
+ }
+}
+
$(document).ready(function() {
- $(window).on("click tap", function() {
+ $(window).on("click", function() {
if (parent.$(".header").is(":visible")) {
parent.show_ui(false);
parent.request_fullscreen();
@@ -8,5 +22,14 @@ $(document).ready(function() {
parent.disable_fullscreen();
}
});
+
+ $(window).on('touchstart', function touch_detect() {
+ $(window).off('touchstart', touch_detect);
+
+ parent._has_touch = true;
+ setup_swipes();
+ });
+
+ setup_swipes();
});