天天看点

jquery平滑滚动到锚点 一行代码

$("html,body").animate({scrollTop: $("#box").offset().top}, 1000);

$("#box")是要去到的锚点,$("html,body")是默认的,不用动。

继续阅读