mirror of
https://github.com/Fluffy-Bean/GameExpo23.git
synced 2025-05-19 09:44:52 +00:00
15 lines
No EOL
468 B
JavaScript
15 lines
No EOL
468 B
JavaScript
window.onscroll = () => { scrollFunction() };
|
|
window.onload = () => { scrollFunction() };
|
|
|
|
function scrollFunction() {
|
|
let nav = document.querySelector("nav");
|
|
// let scrollHeight = window.innerHeight - nav.offsetHeight;
|
|
let scrollHeight = 0;
|
|
|
|
if (document.body.scrollTop > scrollHeight ||
|
|
document.documentElement.scrollTop > scrollHeight) {
|
|
nav.classList.add("scrolled");
|
|
} else {
|
|
nav.classList.remove("scrolled");
|
|
}
|
|
} |