close the nav via 'going back' in the browser #47
@ -1,12 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
function openNavDrawer() {
|
function openNavDrawer() {
|
||||||
navDrawerOverlay.classList.toggle('d-none')
|
navDrawerOverlay.classList.remove('d-none')
|
||||||
navDrawer.style.transform = 'translate(0)'
|
navDrawer.style.transform = 'translate(0)'
|
||||||
window.location.hash = '#nav'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeNavDrawer() {
|
function closeNavDrawer() {
|
||||||
navDrawerOverlay.classList.toggle('d-none')
|
navDrawerOverlay.classList.add('d-none')
|
||||||
navDrawer.style.transform = 'translate(100%)'
|
navDrawer.style.transform = 'translate(100%)'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,15 +64,4 @@
|
|||||||
initToggle(th)
|
initToggle(th)
|
||||||
closeNavDrawer()
|
closeNavDrawer()
|
||||||
})()
|
})()
|
||||||
|
|
||||||
if (window.location.hash == '#nav') {
|
|
||||||
history.replaceState("", document.title, window.location.pathname);
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener('hashchange', function(e) {
|
|
||||||
if (window.location.hash == '') {
|
|
||||||
closeNavDrawer()
|
|
||||||
history.replaceState("", document.title, window.location.pathname);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user