spatest/js/spa.js

17 lines
347 B
JavaScript

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();