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() {
count++;
$out.text('# of scroll events fired: ' + count);
});