Refresh page not at top, header should be nestled up top

This commit is contained in:
Ross Trottier 2024-08-15 17:52:06 -06:00
parent 730362ac79
commit bff6f85252

View File

@ -38,6 +38,14 @@ let lastScrollPosition = 0;
const scrollDepthActivationPoint = 80; const scrollDepthActivationPoint = 80;
window.addEventListener('scroll', function(event) { window.addEventListener('scroll', function(event) {
setHeaderClasses()
});
window.addEventListener('load', function(event) {
setHeaderClasses()
})
function setHeaderClasses() {
const scrollPosition = window.scrollY; const scrollPosition = window.scrollY;
if(scrollPosition < scrollDepthActivationPoint) { if(scrollPosition < scrollDepthActivationPoint) {
@ -59,7 +67,7 @@ window.addEventListener('scroll', function(event) {
} }
lastScrollPosition = scrollPosition; lastScrollPosition = scrollPosition;
}); }
const navItems = document.querySelectorAll('.st-header-icon-bar__item'); const navItems = document.querySelectorAll('.st-header-icon-bar__item');