JSFiddle - React, Tailwind, and code Playground

HTML

<div id="test"></div>

CSS

#test{
    height:2000px;
}

JavaScript

var counter = 1;
$(window).bind('scroll', function() {
    if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {
        alert(counter + " scroll me again");
        counter++;
        if (counter > 6) {
            $(this).unbind('scroll');
            alert('no more scrolling')
        }
    }
});