//Nav slide in logic 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'); }); //Sticky nav logic const iconBar = document.querySelector('.st-header-icon-bar'); const siteTitle = document.querySelector('.st-site-title'); let lastScrollPosition = 0; window.addEventListener('scroll', function(event) { const scrollPosition = window.scrollY; if(scrollPosition < 5) { iconBar.classList.remove('st-icon-bar-sticky'); siteTitle.classList.remove('st-title-scrolled'); } else { if(lastScrollPosition < 5) { iconBar.classList.add('st-icon-bar-sticky'); siteTitle.classList.add('st-title-scrolled'); } } lastScrollPosition = scrollPosition; });