2012-11-10 45 views
0

我想對識別IPAD的觸摸事件做一個動作。 問題是,即使觸摸完成一次,觸發事件也會被多次調用。隨機識別的jquery手機觸摸事件

handleEvent: function (e) { 
var that = this; 
//console.log("---------------------------------handle event "); 
switch(e.type) { 
case START_EV: 
if (!hasTouch && e.button !== 0) return; 
that._start(e); 
break; 
case MOVE_EV: that._move(e); break; 
case END_EV: 
case CANCEL_EV: that._end(e); break; 
case RESIZE_EV: that._resize(); break; 
case 'mouseout': that._mouseout(e); break; 
case 'webkitTransitionEnd': that._transitionEnd(e); break; 
} 
} 

如何識別事件只有一次。

感謝, Vaibhav的

回答

0

的jQuery沒有什麼特別的觸摸事件,但你可以很容易地採用下列事件

touchstart touchmove touchend touchcancel

爲了建立自己的例如touchmove(取自here

document.addEventList ener('touchmove',function(e){e.preventDefault(); var touch = e.touches [0]; alert(touch.pageX +「 - 」+ touch.pageY); },false);