JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<body>
<div id=foo>scroll me</div>
<div id=bar>30</div>
</body>
</html>
CSS
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }
#foo { height: 200px; }
#bar{ margin-bottom: 3000px; }
JavaScript
$(function(){
$(window).on('scroll',function(){
$("#bar").text($("#bar").offset().top);
});
});