From 5b608a82bd1ebfd109520492cd6d9f54736ae862 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sun, 4 May 2025 22:12:32 -0500 Subject: add icons and bottom controls --- src/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/index.js') diff --git a/src/index.js b/src/index.js index 21d0134..59175a0 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,4 @@ +import "./icons.js" import initSlides from "./slides.js" initSlides() @@ -29,11 +30,13 @@ window.addEventListener("popstate", pathnameCallback) pathnameCallback() /* add event listeners for anchor elements in footer */ -function anchorRedirect(e) { +function softRedirect(e) { e.preventDefault() - window.history.pushState({}, "", e.target.href); + let a = e.target + while (a.tagName !== "A" && a !== null) + a = a.parentElement + window.history.pushState({}, "", a.href); pathnameCallback() } -for (const a of document.querySelectorAll("footer a")) - a.addEventListener("click", anchorRedirect) +document.querySelector("#menu").addEventListener("click", softRedirect) -- cgit v1.2.3