diff options
author | Andrew Dolgov <[email protected]> | 2018-01-25 14:55:13 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-01-25 14:55:13 +0300 |
commit | 91c67aba77da85754f0f12664825c0261244a3b4 (patch) | |
tree | 305dda72c295f7c67f611f9947af3596d91a5154 /js/read.js | |
parent | 45ce79df00cafe732d69d615fc210fadaaf6744d (diff) |
hide UI when page changes
Diffstat (limited to 'js/read.js')
-rw-r--r-- | js/read.js | 29 |
1 files changed, 25 insertions, 4 deletions
@@ -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(); } |