JSFiddle - React, Tailwind, and code Playground
by NicoO
HTML
<div class="long">Long content---</div>
<div class="indicator">Current offset: <span id="offset"></span>
</div>
CSS
html {
height: 100%;
width: 100%;
}
html, body
{
margin: 0;
padding: 0;
}
body {
height: 100%;
width: 100%;
overflow: auto;
-webkit-overflow-scrolling: touch;
}
.indicator
{
background-color: lightgray;
padding:5px;
position: fixed;
right:0;
top:0;
}
div.long
{
height: 2000px;
}
JavaScript
$(function(){
$offsetIndicator = $('#offset');
$(window).scroll(function(){
$offsetIndicator.html($(window).scrollTop());
});
});