JSFiddle - React, Tailwind, and code Playground
HTML
<div id="output"># of scroll events fired: 0</div>
<div id="make-scroll"></div>
CSS
html, body{
height : 100%;
}
#make-scroll {
height : 200%;
}
#output {
position : fixed;
top : 0;
left : 0;
}
JavaScript
var count = 0,
$out = $('#output');
$(window).on('scroll', function(){
var scrollHeight = $(document).height();
var scrollPosition = $(window).height() + $(window).scrollTop();
var scroll = (scrollHeight - scrollPosition) / scrollHeight;
console.log('sssss');
});