Detecting extended mousedown event on iPhone
Posted
by Alan Neal
on Stack Overflow
See other posts from Stack Overflow
or by Alan Neal
Published on 2010-03-14T18:54:48Z
Indexed on
2010/03/14
19:05 UTC
Read the original article
Hit count: 227
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?
© Stack Overflow or respective owner