【发布时间】:2011-12-30 06:04:58
【问题描述】:
这个功能很好用。它将正文滚动到所需容器的偏移量
function scrolear(destino){
var stop = $(destino).offset().top;
var delay = 1000;
$('body').animate({scrollTop: stop}, delay);
return false;
}
但不是在 Firefox 中。为什么?
-编辑-
要在接受的答案中处理双触发,我建议在动画之前停止元素:
$('body,html').stop(true,true).animate({scrollTop: stop}, delay);
【问题讨论】:
-
你的最终代码是这里所有代码中最优雅的。