zepto中使用swipeLeft和swipeRight遇到的坑
// 手势事件
$banner.on('swipeLeft',function(){
//左滑
index++;
animation();
});
$banner.on('swipeRight',function(){
// 右滑
index--;
animation();
});
在使用中根本不会触发左右滑动事件,后来在网上了解到可以在注册事件的元素的css中添加touch-action: none; 在测试之后确实可以滑动了,但同时又报了Cannot read property 'trigger' of undefined的错误。。。
最后直接下载了zepto.js的最新版,bug没有了。