JSFiddle - React, Tailwind, and code Playground

HTML

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

CSS

#test{
	width: 100px;
    height: 1000px;
    background-color: black;
}

JavaScript

console.log($(document).height());
console.log($(window).height());
console.log($(document).height() - $(window).height())
var bottom = $(document).height() - $(window).height();

$(document).scroll(function(){
   	console.log($(this).scrollTop())
    if ($(this).scrollTop() === bottom) {
        console.log("bottom");
    } else {
        console.log("scrolling");
    }
});