diff options
author | JJ <nicetry@noemail.com> | 2025-03-19 15:40:51 +0000 |
---|---|---|
committer | JJ <nicetry@noemail.com> | 2025-03-19 15:40:51 +0000 |
commit | 7324691a252761bf3f27365abae21bda0eda8843 (patch) | |
tree | 26f6fd57acca7db7b8cd774fc6dca38604f47b4f /dist/index.js |
Diffstat (limited to 'dist/index.js')
-rw-r--r-- | dist/index.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..9afda23 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,17 @@ +const mobileMenu = document.getElementById("mobile-menu"); +const hamburgerLayers = document.querySelectorAll(".hamburger-layer"); +const header = document.querySelector("header"); + +document.getElementById("hamburger").addEventListener("click", () => { + // Toggle open/close + if (mobileMenu.classList.contains("hidden")) { + mobileMenu.classList.replace("hidden", "flex"); + } else { + mobileMenu.classList.replace("flex", "hidden"); + } + + // Change colour + if (header.classList.contains("text-white")) { + hamburgerLayers.forEach((el) => el.classList.toggle("bg-black!")); + } +}); |