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

来源:互联网 发布:网络教育专科多少费用 编辑:程序博客网 时间:2024/05/18 09:55

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

阅读全文
0 0