JSFiddle - React, Tailwind, and code Playground
by Arpita Jain
HTML
<div class="container">
<div class="currentContent">
<div class="content">
<div style="height:537px">
</div>
<div class="getoffset" style="height: 474px;background-color: red;">
</div>
<div style="height: 500px;">
</div>
</div>
</div>
</div>
CSS
html,body{
height:100%;
margin:0;
padding:0;
} .container,.currentContent{
position:relative;
height:100%
} .currentContent{
overflow: auto;
}
JavaScript
$(document).ready(function () {
$(".currentContent").scroll(function () {
/*alert("scrolTop:"+$(this).scrollTop()+
"offset:"+$(".getoffset").offset());*/
$(".getoffset").html(
"scrolTop:"+$(this).scrollTop()+
"position:"+$(".getoffset").position().top);
});
});