0

I want to do an action on recognition of touch event of IPAD. The issue is that the touch event is being invoked more than once even if the touch is done once.

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

How to recognise the event only once.

Thanks, Vaibhav

SaidbakR
  • 13,303
  • 20
  • 101
  • 195
Vaibhav
  • 19
  • 2

1 Answers1

0

jQuery doesn't have anything special for touch events, but you can easily build your own using the following events

touchstart touchmove touchend touchcancel

For example, the touchmove (Taken from here)

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

Community
  • 1
  • 1
toxicate20
  • 5,270
  • 3
  • 26
  • 38