你的位置:首页 > 软件开发 > 网页设计 > 【转】jquery 中scrollTop在Firefox下不起作用

【转】jquery 中scrollTop在Firefox下不起作用

发布时间:2016-01-13 18:00:04
原文链接:http://stackoverflow.com/questions/8149155/animate-scrolltop-not-working-in-firefox Animate scrollTop not working in firefoxup vot ...

原文链接:http://stackoverflow.com/questions/8149155/animate-scrolltop-not-working-in-firefox

 

 

Animate scrollTop not working in firefox

up vote 115 down vote favorite21

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. Why?

-EDIT-

To handle de double trigger in the acepted answer, I suggest stoping the element before the animation:

$('body,html').stop(true,true).animate({scrollTop: stop}, delay);

up vote 240 down vote accepted

原标题:【转】jquery 中scrollTop在Firefox下不起作用

关键词:jquery

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录