scrollTop jquery, scrolling to div with id?

前端 未结 5 2043
面向向阳花
面向向阳花 2020-12-24 07:08

So this is the current code I have

$(document).ready(function() {
    $(\'.abouta\').click(function(){
        $(\'html, body\').animate({scrollTop:308}, \'s         


        
5条回答
  •  北荒
    北荒 (楼主)
    2020-12-24 07:51

    try this:

    $('html, body').animate({scrollTop:$('#xxx').position().top}, 'slow');
    $('#xxx').focus();
    

提交回复
热议问题