在使用zepto時,我先引入zepto.min.js,然后引入fx.js,但是在使用animate函數時,控制台卻報如下錯誤:
Uncaught TypeError: this.bind is not a function
解決辦法:
1、去github中打開src/fx.js,打開鏈接,把內容添加到zepto.min.js中,問題就解決了。然后需要什么模塊就向zepto.min.js中添加該模塊的內容,最后只用引入zepto.min.js。
2、zepto的定制:
(1)安裝nodejs環境
(2)下載zepto.js並解壓
(3)cmd命令行進入解壓縮后的目錄,執行npm install命令,安裝node工具
(4)打開解壓后的zepto文件下的make文件,找到target.build 部分,添加需要的模塊並保存
(5)cmd執行npm run-script dist,此時zepto目錄下會生成一個dist文件,引入dist文件下的zepto.min.js