summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-07-01 23:03:28 +0300
committerAndrew Dolgov <[email protected]>2018-07-01 23:03:28 +0300
commitf88d911c02715f66dc56c31c4ef2c72ac3ba4eb8 (patch)
tree9a3d7f6bfa96084db93a47fa9e686dd5cf7a5cf7 /js
parent8e2983c91d896b924325b2c9da63fcd476a112aa (diff)
side taps: use reader element margins
Diffstat (limited to 'js')
-rw-r--r--js/read.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/js/read.js b/js/read.js
index 77570c7..455bb03 100644
--- a/js/read.js
+++ b/js/read.js
@@ -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();
}