vanilla/components/threeCard/app.js

14 lines
379 B
JavaScript
Raw Normal View History

2024-11-08 22:35:33 +00:00
const observer = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if(entry.isIntersecting){
entry.target.classList.add('show');
} else {
entry.target.classList.remove('show');
}
});
});
const hiddenElements = document.querySelectorAll('.hidden');
hiddenElements.forEach((el) => observer.observe(el));