2 ms·
>> Are there implementations of infinite scrolling that delete DOM elements outside of a specified range of the viewport? Yes, and these are the only implement
by developer2 9y ago
>> Are there implementations of infinite scrolling that delete DOM elements outside of a specified range of the viewport?
Yes, and these are the only implementations anyone should ever use. You have to remove the DOM elements for rows above and below the viewport (+/- headroom for a couple of rows). When you do so, you use only two placeholder elements to replace the scrollable height of the removed items (one above the viewport, one below).
Any other solution breaks scrolling expectations and/or uses too much memory, which will crash mobile browsers (particularly on iOS). An infinite scroll library is not a 1-day project. It takes a lot of mindful effort to do properly, and nearly every library author takes shortcuts that don't take these requirements into account on their first release.