Spaces:
Running
Running
File size: 1,437 Bytes
97f71e2 8a1f5d0 | 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 | // Intersection Observer for animations
document.addEventListener('DOMContentLoaded', () => {
const animateElements = document.querySelectorAll('.animate-on-scroll');
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-fade-in');
observer.unobserve(entry.target);
}
});
}, {
threshold: 0.1
});
animateElements.forEach(el => observer.observe(el));
// Feather icons replacement
feather.replace();
});
// Smooth scroll for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Current year for footer
document.getElementById('current-year').textContent = new Date().getFullYear();
// Add active class to current nav link
document.querySelectorAll('custom-navbar').forEach(nav => {
const shadowRoot = nav.shadowRoot;
const links = shadowRoot.querySelectorAll('.nav-link');
links.forEach(link => {
link.addEventListener('click', function() {
links.forEach(l => l.classList.remove('active'));
this.classList.add('active');
});
});
});
|