在html页面中,使用a 的href="#"其中#为top锚点,但是当非a标签时,同时(ˇˍˇ) 想~实现top锚点的效果。可使用js控制
1、代码:
$("body,html").animate({scrollTop:$("xxx").offset().top});
2、解释:
(1)、兼容性能:$("body,html")中的“body”支持safari浏览器,”html”支持FF、IE、OPERA…;
(2)、$("xxx").offset().top 为获得要锚点处在当前视口的高度相对偏移 ;
269

被折叠的 条评论
为什么被折叠?



