From c5c3596a73b702711a1aec64233d2164b9b3e0b4 Mon Sep 17 00:00:00 2001 From: Michael Nolan Date: Mon, 17 Oct 2022 08:55:51 +0000 Subject: [PATCH] Original Commit --- js/spa.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 js/spa.js diff --git a/js/spa.js b/js/spa.js new file mode 100644 index 0000000..703a6b4 --- /dev/null +++ b/js/spa.js @@ -0,0 +1,16 @@ +addEventListener('hashchange', (event) => { + setPage(); +}); +function setPage(){ + document.querySelectorAll('.spapage').forEach(e=>{ + e.hidden=true; + }); + var hash=window.location.hash.replace('#',''); + if(hash.length === 0) + { + hash="index"; + } + + document.getElementById(hash).hidden=false; +} +setPage();