magicciv/drafts/site-c/script.js
2026-05-26 02:21:12 -07:00

49 lines
1.5 KiB
JavaScript

// Smooth scroll already handled by CSS scroll-behavior
// Minimal interactivity for polish
document.addEventListener('DOMContentLoaded', () => {
// CTA buttons - prevent default href
document.querySelectorAll('a[href="#"]').forEach(link => {
link.addEventListener('click', (e) => {
e.preventDefault();
console.log('CTA clicked:', link.textContent.trim());
// In a real implementation, these would route to Steam wishlist, docs, etc.
});
});
// Add slight animation on scroll for visible elements
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.animation = 'fadeInUp 0.6s ease-out forwards';
observer.unobserve(entry.target);
}
});
}, observerOptions);
// Observe sections and cards
document.querySelectorAll('section, .feature, .wasm-item, .variant, .stat, .phase').forEach(el => {
observer.observe(el);
});
});
// Add fade-in-up animation
const style = document.createElement('style');
style.textContent = `
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
`;
document.head.appendChild(style);