0

我想对识别 IPAD 的触摸事件采取行动。问题是即使触摸完成一次,触摸事件也会被多次调用。

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;
}
}

如何只识别一次事件。

谢谢, 瓦巴夫

4

1 回答 1

0

jQuery 对触摸事件没有任何特别之处,但您可以使用以下事件轻松构建自己的

touchstart touchmove touchend touchcancel

例如,touchmove(取自此处

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

于 2012-11-10T20:50:30.467 回答