Download script.js from GD-Huggingfaces/power-design-clone-sparkles: direct link, hf CLI and curl.
- Browser
- Download file 1.6 kB
-
https://huggingface.co/spaces/GD-Huggingfaces/power-design-clone-sparkles/resolve/main/script.js
- Command line
-
hf download hf://spaces/GD-Huggingfaces/power-design-clone-sparkles/script.js
-
curl -L -o script.js https://huggingface.co/spaces/GD-Huggingfaces/power-design-clone-sparkles/resolve/main/script.js
1.6 kB
| // Main JavaScript file for functionality | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Mobile menu toggle functionality will be handled by our header component | |
| // Smooth scrolling for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| // Initialize animations | |
| const animateOnScroll = () => { | |
| const elements = document.querySelectorAll('.animate-on-scroll'); | |
| elements.forEach(element => { | |
| const elementPosition = element.getBoundingClientRect().top; | |
| const screenPosition = window.innerHeight / 1.3; | |
| if(elementPosition < screenPosition) { | |
| element.classList.add('animate-fadeInUp'); | |
| } | |
| }); | |
| }; | |
| window.addEventListener('scroll', animateOnScroll); | |
| animateOnScroll(); // Run once on page load | |
| // Project card hover effect | |
| const projectCards = document.querySelectorAll('.project-card'); | |
| projectCards.forEach(card => { | |
| card.addEventListener('mouseenter', () => { | |
| card.querySelector('img').style.transform = 'scale(1.05)'; | |
| }); | |
| card.addEventListener('mouseleave', () => { | |
| card.querySelector('img').style.transform = 'scale(1)'; | |
| }); | |
| }); | |
| // Testimonial carousel would be implemented here if needed | |
| }); |