From bff6f852523eb898ad3694ab53606f41af4f8b37 Mon Sep 17 00:00:00 2001 From: Ross Trottier Date: Thu, 15 Aug 2024 17:52:06 -0600 Subject: [PATCH] Refresh page not at top, header should be nestled up top --- assets/js/st-nav.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/assets/js/st-nav.js b/assets/js/st-nav.js index d672d83..4cb4131 100644 --- a/assets/js/st-nav.js +++ b/assets/js/st-nav.js @@ -38,6 +38,14 @@ let lastScrollPosition = 0; const scrollDepthActivationPoint = 80; window.addEventListener('scroll', function(event) { + setHeaderClasses() +}); + +window.addEventListener('load', function(event) { + setHeaderClasses() +}) + +function setHeaderClasses() { const scrollPosition = window.scrollY; if(scrollPosition < scrollDepthActivationPoint) { @@ -59,7 +67,7 @@ window.addEventListener('scroll', function(event) { } lastScrollPosition = scrollPosition; -}); +} const navItems = document.querySelectorAll('.st-header-icon-bar__item');