19 lines
555 B
JavaScript
19 lines
555 B
JavaScript
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;
|
|
}); |