diff options
author | Andrew Dolgov <[email protected]> | 2018-07-01 23:03:28 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-07-01 23:03:28 +0300 |
commit | f88d911c02715f66dc56c31c4ef2c72ac3ba4eb8 (patch) | |
tree | 9a3d7f6bfa96084db93a47fa9e686dd5cf7a5cf7 /js/read.js | |
parent | 8e2983c91d896b924325b2c9da63fcd476a112aa (diff) |
side taps: use reader element margins
Diffstat (limited to 'js/read.js')
-rw-r--r-- | js/read.js | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -120,21 +120,23 @@ $(document).ready(function() { if ($(".modal").is(":visible")) return; + var reader = $("#reader"); var doc = document.documentElement; - var margin_x = 64; - var margin_y_top = 48; - var margin_y_bottom = 48; + var margin_side = parseInt(reader.css("left"), 10); + var margin_top = parseInt(reader.css("top"), 10); + var margin_bottom = parseInt(reader.css("bottom"), 10); + //console.log(margin_side, margin_top, margin_bottom); //console.log(event.clientY + " " + doc.clientHeight); - if (evt.clientY < margin_y_top || evt.clientY >= doc.clientHeight - margin_y_bottom) { + if (evt.clientY < margin_top || evt.clientY >= doc.clientHeight - margin_bottom) { return; } - if (evt.clientX >= doc.clientWidth - margin_x) { + if (evt.clientX >= doc.clientWidth - margin_side) { console.log("RIGHT SIDE"); next_page(); - } else if (evt.clientX <= margin_x) { + } else if (evt.clientX <= margin_side) { console.log("LEFT SIDE"); prev_page(); } |