1. 程式人生 > >js手機端判斷滑動還是點選

js手機端判斷滑動還是點選

//判斷是滑動還是點選
$('body').on('touchstart touchmove touchend', '#'+_this.model(), function(event) {
            switch(event.type) {
                case 'touchstart':
window[_this.model()].falg = false;
break;
case 'touchmove':
window[_this.model()].falg = true;
break;
case 'touchend':
                    if
( !window[_this.model()].falg) { console.log('點選'); } else { console.log('滑動'); } break; } });