Wednesday, April 11, 2012

jquery - Click event called twice on touchend in iPad - Stack Overflow

jquery - Click event called twice on touchend in iPad - Stack Overflow: "
3
down vote
accepted
iPad both understands touch start - end and mouse start - end.

Is gets fired like this:

-----------------------------------------------------------------------------
|FINGER ENTER TABLET  | FINGER LEAVES TABLET | Small delay after leave      |
-----------------------------------------------------------------------------
| touchstart          | touchend             | mousedown                    |
|                     |                      | mouseup                      |
-----------------------------------------------------------------------------
You have to detect if the user is on a tablet and then relay on the touch start things...:

var isIOS = ((/iphone|ipad/gi).test(navigator.appVersion));
var myDown = isIOS ? "touchstart" : "mousedown";
var myUp = isIOS ? "touchend" : "mouseup";
and then bind it like this:

"

'via Blog this'