Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Track3/hermit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkio Taniguchi <taniguchi@a.phys.nagoya-u.ac.jp>2019-06-22 12:27:00 +0300
committerTrack3 <34504964+Track3@users.noreply.github.com>2019-06-22 12:27:00 +0300
commitc2e02c5dff0ce5372ec81767c9224054a05a0002 (patch)
treec22b62caf9678972e4133aeadf92f28d3640cdb4
parent6cee5adc69ed07b38786f0ad2512c2a4faf31063 (diff)
Fix behaviour of auto-hide header (#78)
Fixed #76: On mobile environment (iOS Safari), when the page scrolls to the top then bounce back, the header (bottom bar) turns to hide unexpectedly. Fixed it by forcing `currentScrollPosition` not a negative value.
-rw-r--r--assets/js/main.js2
-rw-r--r--resources/_gen/assets/js/js/main.js_d11fe7b62c27961c87ecd0f2490357b9.content9
-rw-r--r--resources/_gen/assets/js/js/main.js_d11fe7b62c27961c87ecd0f2490357b9.json1
3 files changed, 1 insertions, 11 deletions
diff --git a/assets/js/main.js b/assets/js/main.js
index 5f0a47c..d18cbaa 100644
--- a/assets/js/main.js
+++ b/assets/js/main.js
@@ -34,7 +34,7 @@ let header = document.getElementById('site-header');
let lastScrollPosition = window.pageYOffset;
const autoHideHeader = () => {
- let currentScrollPosition = window.pageYOffset;
+ let currentScrollPosition = Math.max(window.pageYOffset, 0);
if (currentScrollPosition > lastScrollPosition) {
header.classList.remove('slideInUp');
header.classList.add('slideOutDown');
diff --git a/resources/_gen/assets/js/js/main.js_d11fe7b62c27961c87ecd0f2490357b9.content b/resources/_gen/assets/js/js/main.js_d11fe7b62c27961c87ecd0f2490357b9.content
deleted file mode 100644
index 26f635c..0000000
--- a/resources/_gen/assets/js/js/main.js_d11fe7b62c27961c87ecd0f2490357b9.content
+++ /dev/null
@@ -1,9 +0,0 @@
-const throttle=(callback,limit)=>{let timeoutHandler=null;return()=>{if(timeoutHandler==null){timeoutHandler=setTimeout(()=>{callback();timeoutHandler=null;},limit);}};};const listen=(ele,e,callback)=>{if(document.querySelector(ele)!==null){document.querySelector(ele).addEventListener(e,callback);}}
-let header=document.getElementById('site-header');let lastScrollPosition=window.pageYOffset;const autoHideHeader=()=>{let currentScrollPosition=window.pageYOffset;if(currentScrollPosition>lastScrollPosition){header.classList.remove('slideInUp');header.classList.add('slideOutDown');}else{header.classList.remove('slideOutDown');header.classList.add('slideInUp');}
-lastScrollPosition=currentScrollPosition;}
-let mobileMenuVisible=false;const toggleMobileMenu=()=>{let mobileMenu=document.getElementById('mobile-menu');if(mobileMenuVisible==false){mobileMenu.style.animationName='bounceInRight';mobileMenu.style.webkitAnimationName='bounceInRight';mobileMenu.style.display='block';mobileMenuVisible=true;}else{mobileMenu.style.animationName='bounceOutRight';mobileMenu.style.webkitAnimationName='bounceOutRight'
-mobileMenuVisible=false;}}
-const showImg=()=>{document.querySelector('.bg-img').classList.add('show-bg-img');}
-const hideImg=()=>{document.querySelector('.bg-img').classList.remove('show-bg-img');}
-const toggleToc=()=>{document.getElementById('toc').classList.toggle('show-toc');}
-if(header!==null){listen('#menu-btn',"click",toggleMobileMenu);listen('#toc-btn',"click",toggleToc);listen('#img-btn',"click",showImg);listen('.bg-img',"click",hideImg);document.querySelectorAll('.post-year').forEach((ele)=>{ele.addEventListener('click',()=>{window.location.hash='#'+ele.id;});});window.addEventListener('scroll',throttle(()=>{autoHideHeader();if(mobileMenuVisible==true){toggleMobileMenu();}},250));} \ No newline at end of file
diff --git a/resources/_gen/assets/js/js/main.js_d11fe7b62c27961c87ecd0f2490357b9.json b/resources/_gen/assets/js/js/main.js_d11fe7b62c27961c87ecd0f2490357b9.json
deleted file mode 100644
index e81b6bb..0000000
--- a/resources/_gen/assets/js/js/main.js_d11fe7b62c27961c87ecd0f2490357b9.json
+++ /dev/null
@@ -1 +0,0 @@
-{"Target":"js/main.min.784417f5847151f848c339cf0acb13a06cbb648b1483435a28ed4556c4ead69b.js","MediaType":"application/javascript","Data":{"Integrity":"sha256-eEQX9YRxUfhIwznPCssToGy7ZIsUg0NaKO1FVsTq1ps="}} \ No newline at end of file