Created
March 13, 2025 16:03
-
-
Save nextab/c56f6a0cf46faab4df5ca3f6edb61530 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
// Add scroll class to body when scrolling | |
function handleScroll() { | |
const scrollPosition = window.scrollY || document.documentElement.scrollTop; | |
if (scrollPosition > 0) { | |
document.body.classList.add('scrolling'); | |
} else { | |
document.body.classList.remove('scrolling'); | |
} | |
} | |
handleScroll(); | |
window.addEventListener('scroll', handleScroll, { passive: true }); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment