**“Create a fully responsive and visually appealing Indian-themed restaurant website using HTML, CSS, and JavaScript.
072af4e verified Download js/script.js from Krish101pp/spice-symphony-delight: direct link, hf CLI and curl.
- Browser
- Download file 1.82 kB
-
https://huggingface.co/spaces/Krish101pp/spice-symphony-delight/resolve/main/js/script.js
- Command line
-
hf download hf://spaces/Krish101pp/spice-symphony-delight/js/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Krish101pp/spice-symphony-delight/resolve/main/js/script.js
1.82 kB
| // Smooth scrolling for navigation | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| // Mobile menu toggle | |
| const menuToggle = document.querySelector('.menu-toggle'); | |
| const navMenu = document.querySelector('.nav-menu'); | |
| menuToggle.addEventListener('click', () => { | |
| navMenu.classList.toggle('active'); | |
| menuToggle.classList.toggle('active'); | |
| }); | |
| // Sticky navbar | |
| window.addEventListener('scroll', function() { | |
| const navbar = document.querySelector('custom-navbar'); | |
| if (window.scrollY > 100) { | |
| navbar.classList.add('sticky'); | |
| } else { | |
| navbar.classList.remove('sticky'); | |
| } | |
| }); | |
| // Testimonial slider functionality | |
| let currentTestimonial = 0; | |
| const testimonials = document.querySelectorAll('.testimonial-card'); | |
| const totalTestimonials = testimonials.length; | |
| function showTestimonial(index) { | |
| testimonials.forEach((testimonial, i) => { | |
| testimonial.style.display = i === index ? 'block' : 'none'; | |
| }); | |
| } | |
| function nextTestimonial() { | |
| currentTestimonial = (currentTestimonial + 1) % totalTestimonials; | |
| showTestimonial(currentTestimonial); | |
| } | |
| function prevTestimonial() { | |
| currentTestimonial = (currentTestimonial - 1 + totalTestimonials) % totalTestimonials; | |
| showTestimonial(currentTestimonial); | |
| } | |
| // Initialize first testimonial | |
| showTestimonial(0); | |
| // Set interval for auto-rotation | |
| setInterval(nextTestimonial, 5000); | |
| // Scroll down arrow animation | |
| document.querySelector('.scroll-down').addEventListener('click', function() { | |
| window.scrollBy({ | |
| top: window.innerHeight - 100, | |
| behavior: 'smooth' | |
| }); | |
| }); |