JSFiddle - React, Tailwind, and code Playground

by neal_fletcher

HTML

<div class="hello"></div>

<div class="top">sdf</div>

CSS

.hello {
    position: relative;
    width: 250px; height: 2000px;
    background: orange;
}

.top {
    position: fixed;
    top: 20px; left: 20px;
}

JavaScript

$(window).scroll(function () {
var screenTop = $(document).scrollTop();

$('.top').html(screenTop);
});