Download script.js from davidovicnikola/bubble-no-code-revolution: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/davidovicnikola/bubble-no-code-revolution/resolve/main/script.js
- Command line
-
hf download hf://spaces/davidovicnikola/bubble-no-code-revolution/script.js
-
curl -L -o script.js https://huggingface.co/spaces/davidovicnikola/bubble-no-code-revolution/resolve/main/script.js
1.07 kB
| // Smooth scroll for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| // Add animation class to elements as they come into view | |
| const animateOnScroll = () => { | |
| const elements = document.querySelectorAll('.fade-in'); | |
| elements.forEach(element => { | |
| const elementPosition = element.getBoundingClientRect().top; | |
| const screenPosition = window.innerHeight / 1.3; | |
| if (elementPosition < screenPosition) { | |
| element.classList.add('animate-fadeIn'); | |
| } | |
| }); | |
| }; | |
| window.addEventListener('scroll', animateOnScroll); | |
| window.addEventListener('load', animateOnScroll); | |
| // Mobile menu toggle functionality (will be used by navbar component) | |
| window.toggleMobileMenu = function() { | |
| const menu = document.getElementById('mobile-menu'); | |
| menu.classList.toggle('hidden'); | |
| }; |