js 移动端判断手机的点击次数和滑动执行事件

   document.addEventListener('touchstart', touch, false);
    document.addEventListener('touchmove', touch, false);
    document.addEventListener('touchend', touch, false);
    var tn = 0;
    function touch(event) {
        var event = event || window.event;
        switch (event.type) {
            case "touchstart":
                break;
            case "touchend":
                tn++;
                if (tn >= 2) { //大于点击次数
                    
                }
                break;
            case "touchmove":
           // 执行滑动事件
                break;
        }
   }        

 

posted @ 2017-12-07 15:32  撸的一手好诗  阅读(1249)  评论(0编辑  收藏  举报