onzii's picture
crie uma seção antes e depois para um site, mas deixe bem atraente visualmente
fa98b7a verified
Raw History Blame Contribute Delete
706 Bytes
// 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);
});
});