cppro11225544's picture
Prompt for DeepSite: One-Page Website "CryptoPanda.pro"
dd20981 verified
Raw History Blame Contribute Delete
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();
});
}