1、代码:

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

 

2、解释:

(1)、兼容性能:$("body,html")中的“body”支持safari浏览器,”html”支持FF、IE、OPERA…;

(2)、$("xxx").offset().top 为获得要锚点处在当前视口的高度相对偏移 ;

posted on 2012-02-12 14:13  小老虎网络  阅读(8017)  评论(0编辑  收藏  举报