JSFiddle - React, Tailwind, and code Playground
by Dineshkani
HTML
<div id="firstdiv" class="sample">
Hello Jquery
</div>
<div id="space">Space</div>
<div id="tops">Left Scroll</div><br/><br/>
<div id="wanimate">Left Scroll Animate</div>
CSS
.sample{
font-size: 35px;
color: blue;
}
#space{
visibility: hidden;
height: 500px;
width: 1000px;
}
#tops,#wanimate{
color: white;
height: 60px;
width: 80px;
background-color: grey;
position: relative;
left: 1000px;
cursor: pointer;
text-align:center;
}
JavaScript
//In Jquery
$("#tops").on("click",function(){alert("Position of Scrollbar - " + $("html, body").scrollLeft());$('html, body').scrollLeft("0px")});
$("#wanimate").on("click",function(){$('html, body').animate({"scrollLeft" : "0px"})});
//Scroll to left to see the button.