Detecting extended mousedown event on iPhone
- by Alan Neal
I want to detect an extended mousedown.
The following code works in Firefox and Safari...
var mousedownTimeout;
$('#testButton').mousedown(function(){
mousedownTimeout = window.setTimeout(function(){
alert("Hey, let go.");
}, 2000);
});
$('#testButton').mouseup(function(){
window.clearTimeout(mousedownTimeout);
});
... but not on the iPhone because (quoting quirksmore.org)...
The iPhone fires the mousedown,
mouseup and click events in the
correct order on a click (tap), but it
either fires all three or none at all.
Is there a way around this?