summaryrefslogtreecommitdiff
path: root/js/read.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-01-25 14:55:13 +0300
committerAndrew Dolgov <[email protected]>2018-01-25 14:55:13 +0300
commit91c67aba77da85754f0f12664825c0261244a3b4 (patch)
tree305dda72c295f7c67f611f9947af3596d91a5154 /js/read.js
parent45ce79df00cafe732d69d615fc210fadaaf6744d (diff)
hide UI when page changes
Diffstat (limited to 'js/read.js')
-rw-r--r--js/read.js29
1 files changed, 25 insertions, 4 deletions
diff --git a/js/read.js b/js/read.js
index 0852d0a..8b38277 100644
--- a/js/read.js
+++ b/js/read.js
@@ -1,13 +1,29 @@
var _store_position = 0;
+function show_ui(show) {
+ if (show)
+ $(".header,.footer").fadeIn();
+ else
+ $(".header,.footer").fadeOut();
+}
+
+function toggle_ui() {
+ if ($(".header").is(":visible"))
+ $(".header,.footer").fadeOut();
+ else
+ $(".header,.footer").fadeIn();
+}
+
function next_page() {
_store_position = 1;
window.book.nextPage();
+ show_ui(false);
}
function prev_page() {
window.book.prevPage();
+ show_ui(false);
}
function hotkey_handler(e) {
@@ -25,10 +41,17 @@ function hotkey_handler(e) {
// left
if (e.which == 37) {
- e.preventDefault();;
+ e.preventDefault();
prev_page();
}
+ // esc
+ if (e.which == 27) {
+ e.preventDefault();
+ show_ui(true);
+ }
+
+
} catch (e) {
console.warn(e);
}
@@ -57,9 +80,7 @@ function init_taps() {
if (event.clientX >= doc.clientWidth - margin_x) {
console.log("RIGHT SIDE");
next_page();
- }
-
- if (event.clientX <= margin_x) {
+ } else if (event.clientX <= margin_x) {
console.log("LEFT SIDE");
prev_page();
}