im lazy writing commit messagesm please take a look by yourself thx
This commit is contained in:
+24
-1
@@ -10,4 +10,27 @@ function applyHeaderShadow() {
|
||||
}
|
||||
});
|
||||
}
|
||||
document.addEventListener("DOMContentLoaded", applyHeaderShadow);
|
||||
document.addEventListener("DOMContentLoaded", applyHeaderShadow);
|
||||
|
||||
function applyHeaderAutoHide() {
|
||||
const header = document.querySelector(".web-header-autohide");
|
||||
if (!header) return;
|
||||
|
||||
let lastScrollY = window.scrollY;
|
||||
|
||||
window.addEventListener("scroll", () => {
|
||||
const currentScrollY = window.scrollY;
|
||||
|
||||
if (currentScrollY > lastScrollY && currentScrollY > 0) {
|
||||
// Scrolling down -> hide header
|
||||
header.classList.add("web-header-hidden");
|
||||
} else {
|
||||
// Scrolling up -> show header
|
||||
header.classList.remove("web-header-hidden");
|
||||
}
|
||||
|
||||
lastScrollY = currentScrollY;
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", applyHeaderAutoHide);
|
||||
|
||||
Reference in New Issue
Block a user