Click to scroll the specified element location

 $(document).ready(function (){
     $("#scroll").click(function (){
        $('html, body').animate({
            scrollTop: $("#div").offset().top
        }, 500);
    });
});
    

  Use scrollTop method, with a little delay animation (animate)

Guess you like

Origin www.cnblogs.com/wangyongx/p/10932253.html