JSFiddle - React, Tailwind, and code Playground
HTML
<div id="window">
<div id="foo"></div>
</div>
<a href="#" id="scrollTop" class="margin-top-40 btn btn-danger btn-lg top btn-not-100">Back to top</a>
CSS
#foo { width:300px; height:800px; background-color:#DDD; }
JavaScript
$(function(){
$("#scrollTop").on("click",function(e){
e.preventDefault();
$("body,html").animate({scrollTop: 0}, 'slow');
})
});