JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container" style="position:relative; height:400px; width:100%; overflow:auto; background:red">
<div id="div1" class="clicker" style="height: 1000px; width 100px; ; background:blue">Test</div>
<div id="div2" class="clicker" style="height: 1000px; width 100px; background:green">Test 2</div>
<div id="div3" class="clicker" style="height: 1000px; width 100px; background:yellow">Test 3</div>
</div>
JavaScript
var container = $('#container');
$(".clicker").click(function () {
var top = $(this).position().top,
currentScroll = container.scrollTop();
container.animate({
scrollTop: currentScroll + top
}, 1000);
});