Add some JS to run at DOMContentLoaded that animates the header in

The header animates in when the UA navigates from the home page or from another site,
but not when navigating from other pages on the site.
This commit is contained in:
Eryn Wells 2022-09-25 07:47:09 -07:00
parent 70a380e941
commit 93006dadcb

View file

@ -0,0 +1,16 @@
/* site.js
* Eryn Wells <eryn@erynwells.me>
*/
window.addEventListener("DOMContentLoaded", () => {
const siteHeader = document.querySelector("header.site");
if (!siteHeader) {
return;
}
siteHeader.classList.add("visible");
const documentReferrer = new URL(document.referrer);
if (documentReferrer.pathname === "/") {
siteHeader.classList.add("animated");
}
});