Spaces:
Running
Running
Download script.js from geimsdin/lavishdash-lite: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/spaces/geimsdin/lavishdash-lite/resolve/main/script.js
- Command line
-
hf download hf://spaces/geimsdin/lavishdash-lite/script.js
-
curl -L -o script.js https://huggingface.co/spaces/geimsdin/lavishdash-lite/resolve/main/script.js
1.01 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // Mobile menu toggle | |
| const mobileMenuButton = document.querySelector('[aria-controls="mobile-menu"]'); | |
| if (mobileMenuButton) { | |
| mobileMenuButton.addEventListener('click', () => { | |
| const menu = document.getElementById('mobile-menu'); | |
| menu.classList.toggle('hidden'); | |
| }); | |
| } | |
| // Theme toggle | |
| const themeToggle = document.getElementById('theme-toggle'); | |
| const html = document.documentElement; | |
| themeToggle.addEventListener('click', () => { | |
| html.classList.toggle('dark'); | |
| localStorage.setItem('theme', html.classList.contains('dark') ? 'dark' : 'light'); | |
| }); | |
| // Check for saved theme preference | |
| if (localStorage.getItem('theme') === 'dark' || (!localStorage.getItem('theme') && window.matchMedia('(prefers-color-scheme: dark)').matches)) { | |
| html.classList.add('dark'); | |
| } else { | |
| html.classList.remove('dark'); | |
| } | |
| }); | |