JSFiddle - React, Tailwind, and code Playground

HTML

<div id="container" style="overflow-x:scroll; max-width:1000px;">
  <div id="contained" style="width:3000px;">r</div>
</div>
<div id="log">0%</div>

JavaScript

$('#container').scroll(function(){
    var scrollPercentage=100*this.scrollLeft/this.scrollWidth/(1-this.clientWidth/this.scrollWidth);
    $('#log').html(scrollPercentage.toFixed(2)+'%');
});