JSFiddle - React, Tailwind, and code Playground
by nd87
HTML
<body>
<div id="wrapper">
<div id="bar16">
<a href="#wrapper3" class="topLink">CLICK HERE</a></div>
</div>
<div id="wrapper2" class="wrap">
TWO
</div>
<div id="wrapper3" class="wrap">
THREE
</div>
<p><a href="#anchor" class="topLink">Back to Top</a></p>
CSS
.wrap{
min-height: 1000px;
background:grey;
}
JavaScript
$("a.topLink").click(function() {
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top + "px"}, {duration: 500, easing: "swing"
});
return false;
});