aboutsummaryrefslogtreecommitdiff
path: root/174bg/handbook/source/nav.js
diff options
context:
space:
mode:
authorAlex Pooley (@zuedev) <zuedev@gmail.com>2026-07-16 16:48:48 +0100
committerAlex Pooley (@zuedev) <zuedev@gmail.com>2026-07-16 16:48:48 +0100
commit1768191b23e2ab224cb584f3301da66db75acdc9 (patch)
tree4a072e14e0301a5eaae878b5ab5980d3e442eebe /174bg/handbook/source/nav.js
parentd723827b91cbe59a7ccbb12942172ed00cc2006e (diff)
downloadunnamed-group-1768191b23e2ab224cb584f3301da66db75acdc9.tar
unnamed-group-1768191b23e2ab224cb584f3301da66db75acdc9.tar.gz
unnamed-group-1768191b23e2ab224cb584f3301da66db75acdc9.tar.bz2
unnamed-group-1768191b23e2ab224cb584f3301da66db75acdc9.tar.xz
unnamed-group-1768191b23e2ab224cb584f3301da66db75acdc9.zip
replace handbook with vitepress
Diffstat (limited to '174bg/handbook/source/nav.js')
-rw-r--r--174bg/handbook/source/nav.js53
1 files changed, 0 insertions, 53 deletions
diff --git a/174bg/handbook/source/nav.js b/174bg/handbook/source/nav.js
deleted file mode 100644
index d9a2ab2..0000000
--- a/174bg/handbook/source/nav.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * nav.js
- *
- * Toggles the off-canvas navigation drawer on small screens.
- *
- * How it works:
- * 1. On small screens the sidebar (`#nav`) is positioned off-canvas and
- * revealed by toggling its transform via the hamburger button
- * (`#nav-toggle`).
- * 2. A backdrop (`#nav-backdrop`) is shown while the drawer is open and
- * closes it when clicked.
- * 3. Following any link inside the drawer closes it on mobile so the
- * target section is visible.
- *
- * On medium screens and up the drawer is always visible and these handlers
- * have no visible effect.
- */
-document.addEventListener("DOMContentLoaded", () => {
- const toggle = document.getElementById("nav-toggle");
- const nav = document.getElementById("nav");
- const backdrop = document.getElementById("nav-backdrop");
- if (!toggle || !nav || !backdrop) return;
-
- const open = () => {
- nav.classList.remove("-translate-x-full");
- nav.classList.add("translate-x-0");
- backdrop.classList.remove("hidden");
- toggle.setAttribute("aria-expanded", "true");
- };
-
- const close = () => {
- nav.classList.add("-translate-x-full");
- nav.classList.remove("translate-x-0");
- backdrop.classList.add("hidden");
- toggle.setAttribute("aria-expanded", "false");
- };
-
- toggle.addEventListener("click", () => {
- if (nav.classList.contains("-translate-x-full")) open();
- else close();
- });
-
- backdrop.addEventListener("click", close);
-
- nav.addEventListener("click", (event) => {
- if (
- event.target.closest("a") &&
- window.matchMedia("(max-width: 767px)").matches
- ) {
- close();
- }
- });
-});