JQuery可以用 animate方法回到顶部,但zepto.js用了animate方法是报错的,但看zepto手册是有这个方法的使用说明,原因在于很多扩展功能不在zepto核心文件里,需要去单独引入。
animate需要fx.js。
Git: https://github.com/madrobby/zepto/tree/master/src
fx.js的下载方法:
在zepto官方首页中,按ctrl+F,搜搜fx.js,会搜索出Zepto modules这个表格,点击这里就可以下载fx.js扩展了,最近众所周知的原因,国内网络不太好,有时候下载会失败。
引入fx.js后,用animate就可以使用了,问题解决。