From 3fc47f0d17a22748e92a3b5ba8329edbc5e10403 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Thu, 29 Sep 2022 21:10:35 -0700 Subject: [PATCH] Replace buttons with anchors More semantically accurate and allows link preview on hover --- index.html | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 8882e6a..d4cf2cb 100644 --- a/index.html +++ b/index.html @@ -10,10 +10,10 @@
- - - - + Go to the home page + Go to page 1 + Go to page 2 + Go to page 3
@@ -75,7 +75,10 @@ // Set event handlers for (const router of routers) { - router.addEventListener('click', e => route(e.target.dataset.route)); + router.addEventListener('click', e => { + e.preventDefault(); + route(e.target.dataset.route) + }); } window.onpopstate = _ => showPage(window.location.pathname.substring(1)); -- 2.47.3