slowtwitch-news/assets/js/st-nav.js

19 lines
555 B
JavaScript
Raw Normal View History

2024-06-20 22:15:11 +00:00
const nav = document.querySelector('.st-nav');
const openButton = document.querySelector('.st-open-nav');
const closeButton = document.querySelector('.st-close-nav');
openButton.addEventListener('click', () => {
nav.classList.add('st-nav-is-open');
});
closeButton.addEventListener('click', () => {
nav.classList.remove('st-nav-is-open');
});
let lastScrollPosition = 0;
window.addEventListener('scroll', function(event) {
const scrollPosition = window.scrollY;
console.log(scrollPosition);
lastScrollPosition = scrollPosition;
});