JSFiddle - React, Tailwind, and code Playground

HTML

<div id="cont">
    <div id="progress"></div>
</div>

CSS

html {
    height: 1000px;
}
#cont {
    width: 200px;
    position: fixed;
    top:0;
    bottom: 0;
    height: 5px;
    border: 1px solid #000;
}
#progress {
    background: #F00;
    width: 0%;
    height: 5px;
}

JavaScript

$(window).scroll(function(){
    var ratio = $(document).scrollTop()/(($(document).height() - $(window).height()) / 100);
    $("#progress").width(ratio+"%");
});