diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/read.js | 2 | ||||
-rw-r--r-- | js/reader.js | 25 |
2 files changed, 26 insertions, 1 deletions
@@ -1,5 +1,6 @@ var _store_position = 0; var _enable_fullscreen = 0; +var _has_touch = 0; function request_fullscreen() { if (_enable_fullscreen) @@ -100,6 +101,7 @@ $(document).ready(function() { } } }); + }); function apply_line_height(elem) { 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(); }); |