Infinite scrolling is unusual. Most implementations are “almost infinite” to avoid excessive DOM length (memory). Infinite scrolling: Limits content to an arbitrarily large amount to avoid exhausting memory. Virtual scrolling: Unload everything except the visible viewport + a top and bottom offset. Pad the rest. Virtual scrolling is infinite, but breaks auxiliary actions ( CTRL + F ) because what’s on the screen is the content. document.addEventListener("scroll", function() { console.log(document.querySelectorAll('*').length) }); The most popular library appears to be https://infinite-scroll.com.