jquery 平滑滚动页面到某个锚点

 1 $(document).ready(function() {
 2         $("a.topLink").click(function() {
 3                 $("html, body").animate({
 4                         scrollTop: $($(this).attr("href")).offset().top + "px"
 5                 }, {
 6                         duration: 500,
 7                         easing: "swing"
 8                 });
 9                 return false;
10         });
11 });

 

posted on 2014-06-03 09:02  Cosimo  阅读(825)  评论(0编辑  收藏  举报

导航