cppro11225544/bamboo-bites-crypto-revolution
0
1 2// Smooth scrolling for navigation links3document.querySelectorAll('a[href^="#"]').forEach(anchor => {4 anchor.addEventListener('click', function (e) {5 e.preventDefault();6 7 const targetId = this.getAttribute('href');8 if (targetId === '#') return;9 10 const targetElement = document.querySelector(targetId);11 if (targetElement) {12 const headerHeight = document.querySelector('custom-navigation').offsetHeight;13 window.scrollTo({14 top: targetElement.offsetTop - headerHeight,15 behavior: 'smooth'16 });17 18 // Update URL without page reload19 history.pushState(null, null, targetId);20 }21 });22});23// Sticky navigation effect24window.addEventListener('scroll', function() {25 const nav = document.querySelector('custom-navigation');26 if (window.scrollY > 50) {27 nav.shadowRoot.querySelector('nav').classList.add('scrolled');28 } else {29 nav.shadowRoot.querySelector('nav').classList.remove('scrolled');30 }31});32 33// Animation for roadmap items34function animateRoadmapItems() {35 const items = document.querySelectorAll('#roadmap .flex.items-start');36 items.forEach((item, index) => {37 setTimeout(() => {38 item.classList.add('animate-fadeIn');39 }, index * 200);40 });41}42 43// Initialize animations when page loads44document.addEventListener('DOMContentLoaded', function() {45 animateRoadmapItems();46 47 // Add animation class to hero section48 const hero = document.querySelector('#home .container');49 hero.classList.add('animate-fadeIn');50});51 52// Form submission handler53const contactForm = document.querySelector('#contact form');54if (contactForm) {55 contactForm.addEventListener('submit', function(e) {56 e.preventDefault();57 alert('Thank you for your message! We will get back to you soon.');58 this.reset();59 });60}