File size: 706 Bytes
fa98b7a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | // Animation for before/after sections
document.addEventListener('DOMContentLoaded', () => {
const sections = document.querySelectorAll('div[class*="transform"]');
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('translate-y-0', 'opacity-100');
entry.target.classList.remove('translate-y-10', 'opacity-0');
}
});
}, { threshold: 0.1 });
sections.forEach(section => {
section.classList.add('transition-all', 'duration-500', 'ease-out', 'translate-y-10', 'opacity-0');
observer.observe(section);
});
}); |