diff --git a/assets/js/st-nav.js b/assets/js/st-nav.js index c721121..13851d7 100644 --- a/assets/js/st-nav.js +++ b/assets/js/st-nav.js @@ -1,3 +1,5 @@ +//Nav slide in logic + const nav = document.querySelector('.st-nav'); const openButton = document.querySelector('.st-open-nav'); const closeButton = document.querySelector('.st-close-nav'); @@ -10,10 +12,24 @@ 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; - console.log(scrollPosition); + + 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; }); \ No newline at end of file diff --git a/header.php b/header.php index aa81c8f..936526c 100644 --- a/header.php +++ b/header.php @@ -29,9 +29,8 @@ - -

Slowtwitch

+

Slowtwitch