JSFiddle - React, Tailwind, and code Playground
HTML
<p id="go-to-top">Go to top</p>
CSS
#go-to-top {
margin-top: 2000px;
}
JavaScript
$('#go-to-top').click(function () {
$(window.opera ? 'html' : 'html, body').animate({
scrollTop: 0
}, 1000); // scroll takes 1 second
});