Fork me on GitHub

touchmove和touchend的使用

touchstart:当手指触摸屏幕时触发;即使已经有一个手指放在了屏幕上也会触发。
touchmove:当手指在屏幕上滑动时连续的触发。在这个事件发生期间,调用preventDefault()可阻止滚动。
touchend:当手指从屏幕上移开时触发。
touchcancel:当系统停止跟踪触摸时触发。关于此事件的确切触发事件,文档中没有明确说明。

jQuery在使用这几个事件的时候需要使用事件绑定,即:on或bind

如:有一个按钮button

js中代码为:

$("button").on('touchstart',function(e){
        e.preventDefault();
        //
        });
    }).on('touchend',function(){
        //
    })

 

posted @ 2016-10-11 13:29  gaiyb  阅读(409)  评论(0编辑  收藏  举报