Spaces:
Running
Running
Download script.js from nkjoy/savory-eats-delight: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/spaces/nkjoy/savory-eats-delight/resolve/main/script.js
- Command line
-
hf download hf://spaces/nkjoy/savory-eats-delight/script.js
-
curl -L -o script.js https://huggingface.co/spaces/nkjoy/savory-eats-delight/resolve/main/script.js
1.19 kB
| // Navigation scrolling | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| const targetId = this.getAttribute('href'); | |
| if(targetId === '#') return; | |
| const targetElement = document.querySelector(targetId); | |
| if(targetElement) { | |
| window.scrollTo({ | |
| top: targetElement.offsetTop - 100, | |
| behavior: 'smooth' | |
| }); | |
| } | |
| }); | |
| }); | |
| // Mobile menu toggle | |
| function toggleMobileMenu() { | |
| const mobileMenu = document.getElementById('mobileMenu'); | |
| mobileMenu.classList.toggle('hidden'); | |
| mobileMenu.classList.toggle('block'); | |
| } | |
| // Form validation | |
| function validateReservationForm() { | |
| const form = document.getElementById('reservationForm'); | |
| const inputs = form.querySelectorAll('input, select'); | |
| let isValid = true; | |
| inputs.forEach(input => { | |
| if(!input.value.trim()) { | |
| input.classList.add('border-red-500'); | |
| isValid = false; | |
| } else { | |
| input.classList.remove('border-red-500'); | |
| } | |
| }); | |
| return isValid; | |
| } |