close the nav via 'going back' in the browser (#47)

This PR makes it so that opening the nav used a hash in the browser's location. This way, we can program the 'back' action in the browser to close the nav.

Haven't tested on mobile yet, might be a bit quirky.

Co-authored-by: Steve Russo <steverusso@pm.me>
Reviewed-on: #47
Reviewed-by: jeff <jeff@simplesystems.tech>
Co-authored-by: steverusso <steverusso@protonmail.com>
Co-committed-by: steverusso <steverusso@protonmail.com>
This commit is contained in:
steverusso 2022-04-25 16:38:53 +00:00 committed by jeff
parent 795005fcec
commit 0c70a13a3a

View File

@ -1,11 +1,11 @@
<script>
function openNavDrawer() {
navDrawerOverlay.classList.toggle('d-none')
navDrawerOverlay.classList.remove('d-none')
navDrawer.style.transform = 'translate(0)'
}
function closeNavDrawer() {
navDrawerOverlay.classList.toggle('d-none')
navDrawerOverlay.classList.add('d-none')
navDrawer.style.transform = 'translate(100%)'
}
@ -62,5 +62,6 @@
}
setThemeTo(th)
initToggle(th)
closeNavDrawer()
})()
</script>