Flatlogic Bot 62fc0d99d7 1.0
2025-12-21 12:51:53 +00:00

32 lines
1.0 KiB
JavaScript

document.addEventListener('DOMContentLoaded', function() {
// Smooth scrolling for nav links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Fade-in elements on scroll
const fadeInElements = document.querySelectorAll('.fade-in');
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('is-visible');
} else {
// Optional: remove class when element scrolls out of view
// entry.target.classList.remove('is-visible');
}
});
}, {
threshold: 0.1 // Trigger when 10% of the element is visible
});
fadeInElements.forEach(element => {
observer.observe(element);
});
});