JSFiddle - React, Tailwind, and code Playground
HTML
<div id="scrollbox">
<div id="content"></div>
</div>
CSS
#scrollbox
{
width:200px;
height:500px;
overflow:scroll;
}
#content
{
width:5000px;
height:400px;
}
JavaScript
setInterval(function(){
if(!mouseover)
{
$('#scrollbox').scrollLeft($('#scrollbox').scrollLeft()+1);
}
}, 50);
var mouseover = false;
$('#scrollbox').hover(function(){
mouseover = true;
},function(){
mouseover = false;
});
//$('#scrollbox').scroll(function(){});