JSFiddle - React, Tailwind, and code Playground

HTML

<div id="example1" style="width:100px; height:100px; background-color:#000"></div>

<div id="example2" style="width:100px; height:100px; background-color:#ff0000; position:absolute; top:1000px"></div>

JavaScript

$(document).ready(function() {
    $("html, body").animate({scrollTop: $("#example2").offset().top}, 1000); 
});