Use position fixed for header animation; then position sticky once animation completes

This commit is contained in:
Eryn Wells 2022-10-15 10:17:35 -07:00
parent 172a35e27f
commit 9493b94691
2 changed files with 18 additions and 8 deletions

View file

@ -9,10 +9,17 @@ window.addEventListener("DOMContentLoaded", () => {
}
siteHeader.classList.add("visible");
siteHeader.addEventListener("animationend", () => {
console.log("Animation ended");
siteHeader.classList.add("sticky");
}, false);
try {
const documentReferrer = new URL(document.referrer);
if (documentReferrer.pathname === "/") {
siteHeader.classList.add("animated");
} else {
siteHeader.classList.add("sticky");
}
} catch { }
});