Download script.js from cppro11225544/bamboo-bites-crypto-revolution: direct link, hf CLI and curl.
- Browser
- Download file 1.96 kB
-
https://huggingface.co/spaces/cppro11225544/bamboo-bites-crypto-revolution/resolve/main/script.js
- Command line
-
hf download hf://spaces/cppro11225544/bamboo-bites-crypto-revolution/script.js
-
curl -L -o script.js https://huggingface.co/spaces/cppro11225544/bamboo-bites-crypto-revolution/resolve/main/script.js
1.96 kB
| // Smooth scrolling for navigation 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('custom-navigation').offsetHeight; | |
| window.scrollTo({ | |
| top: targetElement.offsetTop - headerHeight, | |
| behavior: 'smooth' | |
| }); | |
| // Update URL without page reload | |
| history.pushState(null, null, targetId); | |
| } | |
| }); | |
| }); | |
| // Sticky navigation effect | |
| window.addEventListener('scroll', function() { | |
| const nav = document.querySelector('custom-navigation'); | |
| if (window.scrollY > 50) { | |
| nav.shadowRoot.querySelector('nav').classList.add('scrolled'); | |
| } else { | |
| nav.shadowRoot.querySelector('nav').classList.remove('scrolled'); | |
| } | |
| }); | |
| // Animation for roadmap items | |
| function animateRoadmapItems() { | |
| const items = document.querySelectorAll('#roadmap .flex.items-start'); | |
| items.forEach((item, index) => { | |
| setTimeout(() => { | |
| item.classList.add('animate-fadeIn'); | |
| }, index * 200); | |
| }); | |
| } | |
| // Initialize animations when page loads | |
| document.addEventListener('DOMContentLoaded', function() { | |
| animateRoadmapItems(); | |
| // Add animation class to hero section | |
| const hero = document.querySelector('#home .container'); | |
| hero.classList.add('animate-fadeIn'); | |
| }); | |
| // Form submission handler | |
| const contactForm = document.querySelector('#contact form'); | |
| if (contactForm) { | |
| contactForm.addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| alert('Thank you for your message! We will get back to you soon.'); | |
| this.reset(); | |
| }); | |
| } |