JSFiddle - React, Tailwind, and code Playground

HTML

<div></div>

CSS

div {
    height: 2000px;
}

JavaScript

$(document).on('scroll', function () {
    var docHeight = $(document).height(),
        scrollTop = $(document).scrollTop(),
        windowHeight = $(window).height();

    if (docHeight - (scrollTop + windowHeight) <= 100) {
        alert(docHeight - (scrollTop + windowHeight));
    }

});