ApiJ/public/js/app.js

18 lines
393 B
JavaScript
Raw Permalink Normal View History

2024-01-29 07:53:41 +00:00
function onEntry(entry) {
entry.forEach(change => {
if (change.isIntersecting) {
change.target.classList.add('element-show');
}
});
}
let options = {
threshold: [0.5] };
let observer = new IntersectionObserver(onEntry, options);
let elements = document.querySelectorAll('.element-animation');
for (let elm of elements) {
observer.observe(elm);
}