最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Enable quicks (double?) clicks on Ipad Safari - Stack Overflow

programmeradmin2浏览0评论

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 badges
Add a ment  | 

3 Answers 3

Reset to default 1

You 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.

发布评论

评论列表(0)

  1. 暂无评论