I'm building a HTML/JavaScript interface in which I would need some reactivity and so, the possibility for users to click really fast on the same button on the page.
I disabled the doubleclick/zoom on the iPad thanks to the <meta name="viewport" content="user-scalable=no" />
, but then, if I double click or click too fast on the buttons, it does nothing.
I'm using jQuery and tried the dblclick event, didn't work.
I'm building a HTML/JavaScript interface in which I would need some reactivity and so, the possibility for users to click really fast on the same button on the page.
I disabled the doubleclick/zoom on the iPad thanks to the <meta name="viewport" content="user-scalable=no" />
, but then, if I double click or click too fast on the buttons, it does nothing.
I'm using jQuery and tried the dblclick event, didn't work.
Share Improve this question edited May 5, 2011 at 9:06 mu is too short 435k71 gold badges859 silver badges818 bronze badges asked May 5, 2011 at 8:36 user739476user739476 411 gold badge1 silver badge3 bronze badges3 Answers
Reset to default 1You can try using the doubletap plugin which enable the use of "doubletap" events on iPhone and iPad devices.
I gave up on this, rolled my own inside my 'touchstart - move - touchend' sequence. Its horrible, but, inside my touchend, I have :
if (swipeMoving==0) {
swipeStarted = 0;
tapco +=1;
if (tapco==2) doDblClick();
window.setTimeout(function(){ tapco=0; }, 700);
return;
}
If you want click, too, put it in a delay, and cancel if the second click es.
Use this script to use double click in Ipad. http://code.google./p/jquery-ui-for-ipad-and-iphone/
Alternative :-
As click on the desktop browser is equivalent to the touch on the Ipad. So, the double click will be equivalent to the click on the Ipad.
To implement this :
if((navigator.userAgent.match(/iPad/i))){
$(".element").click(function () {/*run the code*/ });
}
else {
$(".element").dblclick(function () {/*run the code*/ });
}
Hope it helps.