From 758f060611e1d9e723861a878153bc46ba295c40 Mon Sep 17 00:00:00 2001 From: Steve Russo Date: Sun, 24 Apr 2022 20:46:34 -0400 Subject: [PATCH 1/2] close the nav via 'going back' in the browser --- layouts/partials/js-global.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/layouts/partials/js-global.html b/layouts/partials/js-global.html index 4179e63..f12cff6 100644 --- a/layouts/partials/js-global.html +++ b/layouts/partials/js-global.html @@ -2,6 +2,7 @@ function openNavDrawer() { navDrawerOverlay.classList.toggle('d-none') navDrawer.style.transform = 'translate(0)' + window.location.hash = '#nav' } function closeNavDrawer() { @@ -62,5 +63,17 @@ } setThemeTo(th) initToggle(th) + 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); + } + }) -- 2.45.2 From 1bb22b9aafd5b63b38d545b0e0af49fc0767e4e1 Mon Sep 17 00:00:00 2001 From: Steve Russo Date: Mon, 25 Apr 2022 08:37:58 -0400 Subject: [PATCH 2/2] just close the nav drawer when the page loads --- layouts/partials/js-global.html | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/layouts/partials/js-global.html b/layouts/partials/js-global.html index f12cff6..f880c53 100644 --- a/layouts/partials/js-global.html +++ b/layouts/partials/js-global.html @@ -1,12 +1,11 @@ -- 2.45.2