JSFiddle - React, Tailwind, and code Playground
HTML
<div id="scrollTop">0</div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /><br />
<br />
<br /><br />
<br />
<br />
<p>the bottom!</p>
CSS
#scrollTop {
position: absolute;
}
JavaScript
$(function() {
$(window).scroll(function() {
$('#scrollTop').css('top', $(window).scrollTop()).text($(window).scrollTop());
});
});