File size: 1,959 Bytes
dd20981 19f4a62 dd20981 19f4a62 dd20981 19f4a62 dd20981 19f4a62 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
// 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();
});
} |