xxxxxxxxxx
let intersectionRoot = document.getElementById("intersectionRoot");
let observedElement = document.getElementById("observedElement");
let shifted = false; // Internal for the example
let interSectionObserver = new IntersectionObserver(
(entries, observer) => {
console.log(entries[0].isIntersecting)
},
{ root: intersectionRoot }
);
interSectionObserver.observe(observedElement);
window.setInterval(
() => {
observedElement.classList.toggle("shifted")
},
1000
)\\ actually it run the body