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

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

不被Firefox支持问题的解决。

其实是使用body的:

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

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

而使用html的:

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

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

如果想让这段代码同时被chromeFirefox都支持的话,应该这样:

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

就是将htmlbody这两者都加上就可以了。

谢谢!!!

posted on 2017-04-24 14:50  Kingchan  阅读(348)  评论(0编辑  收藏  举报