scrolltop with animate not working

后端 未结 6 831
梦毁少年i
梦毁少年i 2020-12-01 11:53

I\'m trying to animate while scrolling but no luck with my code...

I have this jquery

$(window).scrollTop(200);

Now wanted to give

6条回答
  •  心在旅途
    2020-12-01 12:36

    DEMO

    
    function scrollmetop(dest){
        var stop = $(dest).offset().top;
        var delay = 1000;
        $('body,html').animate({scrollTop: stop}, delay);
        return false;
    }
    
    scrollmetop('#test');
    
        
    target object

提交回复
热议问题