問題:
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