Event on scroll
-
Hi and thanks for your plugin. It works nice.
I would like it to use it only on scroll up so i wrote this code
let scrollPos = 0; const nav = document.querySelector('.wcbb-bottom-bar'); function checkPosition() { let windowY = window.scrollY; if (windowY < scrollPos) { // Scrolling UP nav.classList.add('is-visible'); nav.classList.remove('is-hidden'); } else { // Scrolling DOWN nav.classList.add('is-hidden'); nav.classList.remove('is-visible'); } scrollPos = windowY; } window.addEventListener('scroll', checkPosition);
But it seems to not work.
Do you have any idea of how you could help me with this?
Thanks
- The topic ‘Event on scroll’ is closed to new replies.