add js for dynamic class for navbar

This commit is contained in:
2025-08-25 21:11:05 +07:00
parent 2c8a4aa8b3
commit 61181264f8
+13
View File
@@ -0,0 +1,13 @@
function applyHeaderShadow() {
const header = document.querySelector(".web-header-emit-shadow-when-top");
if (!header) return;
window.addEventListener("scroll", () => {
if (window.scrollY > 0) {
header.classList.add("shadow-active");
} else {
header.classList.remove("shadow-active");
}
});
}
document.addEventListener("DOMContentLoaded", applyHeaderShadow);