File size: 1,064 Bytes
9913363 |
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 |
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Intersection Observer for animations
const animateOnScroll = () => {
const sections = document.querySelectorAll('section');
const observer = new IntersersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-fadeIn');
observer.unobserve(entry.target);
}
});
}, {
threshold: 0.1
});
sections.forEach(section => {
observer.observe(section);
section.classList.add('opacity-0', 'transition-opacity', 'duration-500');
});
};
document.addEventListener('DOMContentLoaded', () => {
animateOnScroll();
console.log('Cosmic Context Navigator loaded π');
}); |