JSFiddle - React, Tailwind, and code Playground

by Mohamed Amer

HTML

<div></div>
<div id="next_div">Another Div here</div>

CSS

div{
    margin: 10px;
    height: 400px;
    background: red;
    color : #fff;
}

JavaScript

$(document).ready(function(){
    $(window).on('scroll',function(){
        if($(this).scrollTop() > 50){
            $('html,body').animate({scrollTop : $('#next_div').offset().top});
        }
    });
});