diff options
author | Andrew Dolgov <[email protected]> | 2018-07-02 14:11:52 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-07-02 14:11:52 +0300 |
commit | 0ce9f005423032539af41b280c3422507408edfd (patch) | |
tree | 492c0f11f195b1546c3b1083965d60137e05b087 | |
parent | 7b462f0b3ce566ac7edba96507ca951371705776 (diff) |
use jquery wheel event handler
-rw-r--r-- | js/reader.js | 10 | ||||
-rw-r--r-- | read.html | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/js/reader.js b/js/reader.js index d7eddbe..d3614aa 100644 --- a/js/reader.js +++ b/js/reader.js @@ -13,7 +13,7 @@ function enable_swipes() { } $(document).ready(function() { - $(window).on("mouseup", function(evt) { + $(window).on("click tap", function(evt) { if (evt.button == 0) { if ($(".modal").is(":visible")) @@ -35,6 +35,14 @@ $(document).ready(function() { $(window).off("swipeleft swiperight"); }); + $(window).on("wheel", function(evt) { + if (evt.originalEvent.deltaY > 0) { + parent.next_page(); + } else if (evt.originalEvent.deltaY < 0) { + parent.prev_page(); + } + }); + enable_swipes(); }); @@ -431,14 +431,6 @@ rendition.hooks.content.register(function(contents) { - $("#reader iframe")[0].contentWindow.onwheel = function(event) { - if (event.deltaY > 0) { - next_page(); - } else if (event.deltaY < 0) { - prev_page(); - } - }; - var base_url = window.location.href.match(/^.*\//)[0]; var res_names = [ "lib/bootstrap/v3/js/jquery.js", "lib/jquery.mobile.custom.js", "js/reader.js", "js/dict.js" ]; |