滚动到特定的DIV - jquery

时间:2014-10-25 20:32:37

标签: jquery

如何滚动到特定DIV的顶部?

$('html, body').animate({ scrollTop: 0 }, 500);

1 个答案:

答案 0 :(得分:0)

$("html, body").animate({
    'scrollTop' : $('#thediv').offset().top
}, "slow"); // or fast, number

对于此标记

<div id="thediv"></div>