function onEntry(entry) {
entry.forEach(change => {
if (change.isIntersecting) {
change.target.classList.add('scroll-on');
}
else {
change.target.classList.remove('scroll-on');
}
});
}
let options = {
threshold: [0.5] };
let observer = new IntersectionObserver(onEntry, options);
let elements = document.querySelectorAll('.scroll-off');
for (let elm of elements) {
observer.observe(elm);
}
entry.forEach((change) => {
change.target.classList.toggle('scroll-on', change.isIntersecting);
change.target.classList.toggle('second-classname', change.isIntersecting);
})