【转载】$("body").animate({"scrollTop":top})不被Firefox支持问题的解决

jQuery中animate()的方法可以去w3school查看,这里主要说一下:

$("body").animate({"scrollTop":top})

不被Firefox支持问题的解决。

其实是使用body的:

$("body").animate({"scrollTop":top})

只被chrome支持,而不被Firefox支持。

而使用html的:

$("html").animate({"scrollTop":top})

只被Firefox支持,而不被chrome支持。

如果想让这段js被chrome和Firefox都支持的话,应该这样:

$("html,body").animate({"scrollTop":top})

看到了吗,就是将htmlbody这两者都加上就可以了。

本文出自【我是干勾鱼的博客】http://blog.csdn.net/dongdong9223/article/details/50846678

猜你喜欢

转载自blog.csdn.net/xiaoxiaohai0000/article/details/77478108
今日推荐