add js for dynamic class for navbar
This commit is contained in:
@@ -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);
|
||||||
Reference in New Issue
Block a user