JSFiddle - React, Tailwind, and code Playground

by Darksbane

HTML

<div style='overflow:auto;height:90px;width:160px'>
    Moby-Dick, also known as The Whale,[1] is a novel first published in 1851 by American author Herman Melville. Moby-Dick is widely considered to be a Great American Novel and a treasure of world literature. The story tells the adventures of the wandering sailor Ishmael, and his voyage on the whaleship Pequod, commanded by Captain Ahab. Ishmael soon learns that Ahab seeks one specific whale: Moby Dick, a ferocious, enigmatic white sperm whale. In a previous encounter, the whale destroyed Ahab's boat and bit off his leg. Ahab intends to take revenge.
    
</div>

JavaScript

var aarray = [];
$(document).ready(function(){
    
    $('div').bind('scroll',chk_scroll);
    for (var i=0;i<500;i++){
    aarray.push(i);
}
    var blah;
});



bottom = 25;

function chk_scroll(e)
{
    var elem = $(e.currentTarget);
    if (elem[0].scrollHeight - elem.scrollTop() == elem.outerHeight()) 
    {
        if (bottom <= aarray.length){
        console.log("bottom");
        myasdf=aarray.splice(0,25).join('<br>');
        bottom+=25
        elem.append(myasdf)
        }
    }

}