From 33cdec2fd4c124e181356be81a756aa6824c4ec2 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Thu, 24 Sep 2015 13:55:02 +0800 Subject: [PATCH] Updated to lock the navbar on changeMode --- public/js/index.js | 11 +++++++++++ public/vendor/showup/showup.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/public/js/index.js b/public/js/index.js index 26fc0cc..a902a6f 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -550,6 +550,7 @@ function toggleMode() { } function changeMode(type) { + lockNavbar(); saveInfo(); if (type) currentMode = type; @@ -616,6 +617,16 @@ function changeMode(type) { ui.toolbar.view.addClass("active"); modeIcon.addClass('fa-toggle-on'); } + unlockNavbar(); +} + +function lockNavbar() { + $('.navbar').addClass('locked'); +} + +var unlockNavbar = _.debounce(function () { + $('.navbar').removeClass('locked'); +}, 200); } //button actions diff --git a/public/vendor/showup/showup.js b/public/vendor/showup/showup.js index f4f2267..da98785 100755 --- a/public/vendor/showup/showup.js +++ b/public/vendor/showup/showup.js @@ -36,7 +36,7 @@ target.clearQueue(); target.stop(); var currentScroll = $(this).scrollTop(); - if (currentScroll > hideOffset) { + if (currentScroll > hideOffset && !target.hasClass('locked')) { if(Math.abs(previousScroll - currentScroll) < 50) return; if (currentScroll > previousScroll) { // Action on scroll down