12 lines
363 B
JavaScript
12 lines
363 B
JavaScript
// Fade in elements as they scroll into view
|
|
const observer = new IntersectionObserver((entries) => {
|
|
for (const entry of entries) {
|
|
if (entry.isIntersecting) {
|
|
entry.target.classList.add('visible');
|
|
observer.unobserve(entry.target);
|
|
}
|
|
}
|
|
}, { threshold: 0.1 });
|
|
|
|
document.querySelectorAll('section').forEach((el) => observer.observe(el));
|