"0px", threshold: 0.5, }; let observer = new IntersectionObserver(callback, options); document.querySelectorAll("*").forEach(element => { observer.observe(element); }); let callback = (entries, observer) => { entries.forEach((entry) => { // Each entry describes an intersection change // for one observed target element: // entry.boundingClientRect // entry.intersectionRatio // entry.intersectionRect // entry.isIntersecting // entry.rootBounds // entry.target // entry.time }); };