diff --git a/static/index.html b/static/index.html index 85be89a..6bfb01e 100644 --- a/static/index.html +++ b/static/index.html @@ -7,6 +7,7 @@ -->
+ diff --git a/static/script-bon.js b/static/script-bon.js index 87cf859..5d09dd1 100644 --- a/static/script-bon.js +++ b/static/script-bon.js @@ -116,10 +116,10 @@ async function setupPage() { } let lastScrollTop = 0; - let isScrolling = false; + let isCallbackRegistered = false; window.addEventListener("scroll", function() { - if (!isScrolling) { + if (!isCallbackRegistered) { window.requestAnimationFrame(function() { let currentPosition = window.scrollY || document.documentElement.scrollTop; const toggleButton = document.querySelectorAll('.toggleButton'); @@ -135,12 +135,11 @@ async function setupPage() { button.style.display = "block"; }); } - lastScrollTop = currentPosition <= 0 ? 0 : currentPosition; // For Mobile or negative scrolling - isScrolling = false; + isCallbackRegistered = false; }); - isScrolling = true; + isCallbackRegistered = true; } }); }