Created
June 3, 2025 07:22
-
-
Save Kcko/40165d45f070f71d7f9917f58d681270 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const observer = new IntersectionObserver(entries => { | |
entries.forEach(entry => { | |
if (entry.isIntersecting) { | |
entry.target.classList.add('fade-in'); | |
} | |
}); | |
}); | |
document.querySelectorAll('.section').forEach(section => { | |
observer.observe(section); | |
}); | |
<style> | |
.section { | |
opacity: 0; | |
transition: opacity 1s; | |
} | |
.section.fade-in { | |
opacity: 1; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment