Download script.js from Alexander1337/fitflow-coaching: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/spaces/Alexander1337/fitflow-coaching/resolve/main/script.js
- Command line
-
hf download hf://spaces/Alexander1337/fitflow-coaching/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Alexander1337/fitflow-coaching/resolve/main/script.js
1.23 kB
| // Smooth scroll for anchor links | |
| document.addEventListener('click', function(e) { | |
| if (e.target.matches('a[href^="#"]')) { | |
| e.preventDefault(); | |
| const target = document.querySelector(e.target.getAttribute('href')); | |
| if (target) { | |
| target.scrollIntoView({ behavior: 'smooth' }); | |
| } | |
| } | |
| }); | |
| // Intersection Observer for animations | |
| const animateOnScroll = () => { | |
| const elements = document.querySelectorAll('.animate'); | |
| const observer = new IntersectionObserver((entries) => { | |
| entries.forEach(entry => { | |
| if (entry.isIntersecting) { | |
| entry.target.classList.add('animate-visible'); | |
| } | |
| }); | |
| }, { threshold: 0.1 }); | |
| elements.forEach(el => observer.observe(el)); | |
| }; | |
| // Mobile menu toggle | |
| const setupMobileMenu = () => { | |
| const menuBtn = document.querySelector('.mobile-menu-btn'); | |
| const mobileMenu = document.querySelector('.mobile-menu'); | |
| if (menuBtn && mobileMenu) { | |
| menuBtn.addEventListener('click', () => { | |
| const isOpen = mobileMenu.style.display === 'flex'; | |
| mobileMenu.style.display = isOpen ? 'none' : 'flex'; | |
| }); | |
| } | |
| }; | |
| // Initialize all functions | |
| document.addEventListener('DOMContentLoaded', () => { | |
| animateOnScroll(); | |
| setupMobileMenu(); | |
| }); | |