At the moment, I am monitoring the last child, each time after adding new ones, I reset the observation and put it on the new last child element.
I’m trying to figure it out. How to make an observation of the parent, a part of it is always visible.
How to make the IntersectionObserver fire for 100px when the bottom edge of it crosses the viewport.
let element = document.createElement('div');
//...append
(new IntersectionObserver((m, observer) => {
if(m[0].isIntersecting) {
// Adding elements to the block
}
},
{root: null, rootMargin: `0px 0px 100px 0px`, threshold: 0})).observe(element);