问题:
This function works fine. 这个功能很好。 It scrolls the body to a desired container's offset 它将主体滚动到所需容器的偏移量
function scrolear(destino){
var stop = $(destino).offset().top;
var delay = 1000;
$('body').animate({scrollTop: stop}, delay);
return false;
}
But not in Firefox. 但不是在Firefox中。 Why? 为什么?
-EDIT- -编辑-
To handle de double trigger in the accepted answer, I suggest stoping the element before the animation: 要在接受的答案中处理de double触发器,我建议在动画之前停止元素:
$('body,html').stop(true,true).animate({scrollTop: stop}, delay);
解决方案:
参考一: https://en.stackoom.com/question/YBxz参考二: https://stackoom.com/question/YBxz