JSFiddle - React, Tailwind, and code Playground

by Christian Gambardella

HTML

<div id="articles">
    
</div>

CSS

#articles {
    width: 100%;
    height: 2000px;
    background-color: #aaa;
    
}

JavaScript

console.log( $(window).height(), $("#articles").height() );

//$(document).bind(
$(window).bind('scroll', function() {
    var windowHeight = $(window).height();
    var articlesHeight = parseInt($('#articles').innerHeight());
    var currentScrollY = parseInt($(this).scrollTop());
    
    
    console.log( articlesHeight - currentScrollY - windowHeight <= 200 );
});