diff options
Diffstat (limited to 'js/navigation.ts')
-rw-r--r-- | js/navigation.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/js/navigation.ts b/js/navigation.ts new file mode 100644 index 0000000..1e9ec81 --- /dev/null +++ b/js/navigation.ts @@ -0,0 +1,18 @@ +function toggleSideMenu() { + let navBar = document.getElementById("navBar"); + let sideMenu = document.getElementById("sideMenu"); + + if (!navBar) { + throw new Error("unable to find navigation bar"); + } + + if (!sideMenu) { + throw new Error("unable to find side menu"); + } + + sideMenu.classList.toggle("visible"); + + for (let link of navBar.getElementsByTagName("a")) { + link.classList.toggle("hidden"); + } +} |