portfolio-webpage/public/js/scroll.js

11 lines
242 B
JavaScript
Raw Normal View History

2024-04-04 22:08:06 +02:00
function onScroll() {
const header = document.getElementById("header")
if (window.scrollY > 0) {
header.classList.add("scrolled")
} else {
header.classList.remove("scrolled")
}
}
document.addEventListener("scroll", onScroll)