JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<div id="scroller"></div>
</div>
CSS
#container {
height: 5000px;
width: 100%;
}
#scroller {
height: 25px;
width: 25px;
background-color: black;
position: fixed;
}
JavaScript
window.addEventListener("scroll", myFunc.bind(this, document.getElementById("scroller")), false);
function myFunc(div) {
var scroll = document.body.scrollTop;
div.style.top = (scroll / 10)+"px";
};