移动端开发以来,逐渐的厌倦了寄人篱下的日子!果断自己造了个轮子。
eTouch,是我闲暇之余的一个移动端js简单手势库。
目前满足以下几个功能(请用移动端模式测试)
- tap 事件的实现
- 进行单指滑动的实时监控
- up、right、down、left滑动完毕的回调
- 并且支持复杂选择器的事件委托
本demo为高级事件,通过设置e.clock = true给容器带锁
各种方向滑动完成时的回调(带锁)
我是POX进来滑动试试
请看打开控制台看log
请看打开控制台看log
etouch("#pox",function(e,touch) {
e.clock = true;//当你想完全不触发任何浏览器默认行为 可以这样给div加个锁
}).on('swiper',function(e,touch) {
//实时获取
console.log(touch);
}).on('up',function(e,touch) {
$("#coming").html('上滑动
');
console.log(touch);
}).on('left',function(e,touch) {
$("#coming").html('左滑动
');
console.log(touch);
}).on('right',function(e,touch) {
$("#coming").html('右滑动
');
console.log(touch);
}).on('down',function(e,touch) {
$("#coming").html('下滑动
');
console.log(touch);
});