How to scroll to the particular div using jquery or javascript

后端 未结 5 995
耶瑟儿~
耶瑟儿~ 2021-02-07 16:25

I want to scroll to the particular div using jquery

I have written the code like:

 $(\"#button\").on(\'click\',function(){
     var p = $(\"#dynamictabst         


        
5条回答
  •  日久生厌
    2021-02-07 17:31

    Try this

    $("#button").on('click',function() {
        $('html, body').animate({
            'scrollTop' : $("#dynamictabstrp").position().top
        });
    });
    

    .scrollTop()

提交回复
热议问题