Download script.js from LeLocalDigitalWeb/fleur-rustique-chic-l-glantine-landing: direct link, hf CLI and curl.
- Browser
- Download file 3.25 kB
-
https://huggingface.co/spaces/LeLocalDigitalWeb/fleur-rustique-chic-l-glantine-landing/resolve/main/script.js
- Command line
-
hf download hf://spaces/LeLocalDigitalWeb/fleur-rustique-chic-l-glantine-landing/script.js
-
curl -L -o script.js https://huggingface.co/spaces/LeLocalDigitalWeb/fleur-rustique-chic-l-glantine-landing/resolve/main/script.js
3.25 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // Mobile menu toggle | |
| const mobileMenuButton = document.querySelector('.md\\:hidden button'); | |
| const mobileMenu = document.createElement('div'); | |
| mobileMenu.className = 'fixed inset-0 bg-white z-50 flex flex-col items-center justify-center hidden'; | |
| mobileMenu.innerHTML = ` | |
| <div class="absolute top-6 right-6"> | |
| <button class="text-sage-700"> | |
| <i data-feather="x"></i> | |
| </button> | |
| </div> | |
| <nav class="flex flex-col items-center space-y-8 text-2xl"> | |
| <a href="#accueil" class="text-sage-700 hover:text-sage-500">Accueil</a> | |
| <a href="#creations" class="text-sage-700 hover:text-sage-500">Créations</a> | |
| <a href="#saison" class="text-sage-700 hover:text-sage-500">Saison</a> | |
| <a href="#contact" class="text-sage-700 hover:text-sage-500">Contact</a> | |
| <a href="tel:+3381347689" class="bg-sage-700 text-white px-6 py-3 rounded-full mt-4"> | |
| <i data-feather="phone" class="inline mr-2"></i> 03 81 34 76 89 | |
| </a> | |
| </nav> | |
| `; | |
| document.body.appendChild(mobileMenu); | |
| mobileMenuButton.addEventListener('click', function() { | |
| mobileMenu.classList.remove('hidden'); | |
| feather.replace(); | |
| }); | |
| mobileMenu.querySelector('button').addEventListener('click', function() { | |
| mobileMenu.classList.add('hidden'); | |
| }); | |
| // Smooth scrolling for anchor links | |
| 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) { | |
| const headerHeight = document.querySelector('nav').offsetHeight; | |
| const targetPosition = targetElement.getBoundingClientRect().top + window.pageYOffset - headerHeight; | |
| window.scrollTo({ | |
| top: targetPosition, | |
| behavior: 'smooth' | |
| }); | |
| // Close mobile menu if open | |
| mobileMenu.classList.add('hidden'); | |
| } | |
| }); | |
| }); | |
| // Animate elements when they come into view | |
| const animateOnScroll = function() { | |
| const elements = document.querySelectorAll('.animate-fade-in'); | |
| elements.forEach(element => { | |
| const elementPosition = element.getBoundingClientRect().top; | |
| const screenPosition = window.innerHeight / 1.3; | |
| if (elementPosition < screenPosition) { | |
| element.style.opacity = '1'; | |
| element.style.transform = 'translateY(0)'; | |
| } | |
| }); | |
| }; | |
| // Set initial state for animated elements | |
| document.querySelectorAll('.animate-fade-in').forEach(element => { | |
| element.style.opacity = '0'; | |
| element.style.transform = 'translateY(20px)'; | |
| element.style.transition = 'opacity 0.6s ease, transform 0.6s ease'; | |
| }); | |
| // Run once on load and then on scroll | |
| animateOnScroll(); | |
| window.addEventListener('scroll', animateOnScroll); | |
| // Current year in footer | |
| document.querySelector('footer p:first-of-type').innerHTML = `© ${new Date().getFullYear()} L'Églantine. Tous droits réservés.`; | |
| // Replace feather icons (already called in HTML but just in case) | |
| feather.replace(); | |
| }); |