From 93006dadcbb69856dd014d9cb3e64652af75d7dc Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 25 Sep 2022 07:47:09 -0700 Subject: [PATCH] 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. --- static/scripts/site.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/static/scripts/site.js b/static/scripts/site.js index e69de29..b8638e8 100644 --- a/static/scripts/site.js +++ b/static/scripts/site.js @@ -0,0 +1,16 @@ +/* site.js + * Eryn Wells + */ + +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"); + } +});