IPad Touchstart Shooting Twice

I am working on cross-platform touch events. (swiping, etc.) They work on Android devices, but for the iPad, the touchstart event fires twice.

this.element.addEventListener('touchstart', mousedown, false); var mousedown = function(event) { // Finger Press event.preventDefault(); _this.inGesture = true; _this._originalX = (event.touches) ? event.touches[0].pageX : event.pageX; _this._originalY = (event.touches) ? event.touches[0].pageY : event.pageY; }; 

This feature works twice on the iPad, but works correctly on Android.

I have to add that it starts touchstart, then touches it, then touches it, and finally, for some reason, it makes another touch start.

Here it is on JSFiddle: http://jsfiddle.net/6Lb3Z/1

Screenshot: http://i.imgur.com/GS8uI.png

+7
source share
1 answer

If you use a library like jQuery or Zepto, you can use the .one method.

From the jQuery API documentation :

Attach a handler to the event for elements. The handler is executed no more than once per element.

0
source

All Articles