diff options
| author | Ariel Costas <94913521+arielcostas@users.noreply.github.com> | 2024-02-03 00:46:23 +0100 |
|---|---|---|
| committer | Ariel Costas <94913521+arielcostas@users.noreply.github.com> | 2024-02-03 00:46:23 +0100 |
| commit | 2763ae085bc157712571b42ff0d77481a31160bc (patch) | |
| tree | c576d614f013cb7aab17b9467e58e50fc62c8a3b /assets/js | |
| parent | c7f8158cb95cf2f0a5d95036a725f7d74f9b0067 (diff) | |
Responsive navbar
Diffstat (limited to 'assets/js')
| -rw-r--r-- | assets/js/navbar.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/assets/js/navbar.js b/assets/js/navbar.js new file mode 100644 index 0000000..902ed8f --- /dev/null +++ b/assets/js/navbar.js @@ -0,0 +1,10 @@ +/** @type {HTMLElement} */ +const header = document.querySelector('body > header'); +/** @type {HTMLButtonElement} */ +const toggleButton = document.querySelector('button#mobile-menu'); + +function toggleNavbar() { + header.classList.toggle('collapsed'); +} + +toggleButton.addEventListener('click', toggleNavbar);
\ No newline at end of file |
