Scroll to specific div on page load

后端 未结 3 660
长发绾君心
长发绾君心 2020-12-24 02:34

I\'m trying to figure out how get the page automaticlly scroll to a specific div when the page has loaded. I have tried using the jQuery scroll function, but cant get it to

3条回答
  •  生来不讨喜
    2020-12-24 02:57

    $(document).ready(function(){
        $("html, body").animate({ 
            scrollTop: $('.sb-menu').offset().top 
        }, 1000);
    });
    

提交回复
热议问题