JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<body>
<div style="margin: 100px 100px 1000px 100px">
<div id="test" style="width: 300px; height: 100px; border: 3px solid blue;">This is my div</div>
</div>
</body>
</html>
JavaScript
function scrollmetop(dest){
var stop = $(dest).offset().top;
var delay = 1000;
$('body,html').animate({scrollTop: stop}, delay);
return false;
}
scrollmetop('#test');