nmrghe's picture
could you add a way to navigate in between pages at the top ?
60a860d verified
// Shared JavaScript functions
document.addEventListener('DOMContentLoaded', function() {
// 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'
});
});
});
// Add animation classes to elements
const animateElements = document.querySelectorAll('.fade-in, .slide-up');
animateElements.forEach(el => {
el.style.opacity = '0';
});
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add(entry.target.dataset.animation || 'fade-in');
entry.target.style.opacity = '1';
observer.unobserve(entry.target);
}
});
}, { threshold: 0.1 });
animateElements.forEach(el => {
observer.observe(el);
});
});