带有 Android 4.2 的 Phonegap 2.4.0 - 奇怪的双击行为 [英] Phonegap 2.4.0 with Android 4.2 - strange double click behaviour

查看:19
本文介绍了带有 Android 4.2 的 Phonegap 2.4.0 - 奇怪的双击行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 phonegap 2.4.0 创建一个 Android 和 iOS 应用程序.

I'm using phonegap 2.4.0 to create an Android and iOS App.

现在我发现链接中的 onclick 事件在 Nexus 4 设备上使用 Android 4.2.2 的 Android 应用程序内触发了两次,就像双击一样(尽管我只点击了一次!).

Now I recognized that the onclick event in links is fired twice inside the Android App using Android 4.2.2 on a Nexus 4 device, like a double click (althoug I tapped it only once!).

<a href="#" onclick="$(this).append('test'); return false;" style="some styles...">some text</a>

正在使用的库:

  • jquery 1.9.1
  • jquery mobile 1.3.0 (rc)
  • jquery ui 1.10.0
  • jquery touch punch 0.2.2
  • phonegap 2.4.0

在我点击(或点击)我的 Nexus 4 (Android 4.2.2) 上的链接后,字符串test"会在应用程序内附加两次.

After I clicked (or tapped) the link on my Nexus 4 (Android 4.2.2) the string 'test' is appended twice inside the app.

当我直接在 android 浏览器中将其作为移动网络应用程序进行测试时,不会发生这种情况.

This does NOT happen when I test it as mobile web app directly in the android browser.

它也适用于应用程序内的我的三星 S3 (Android 4.1.2).iPhone 上也没有问题.

It also works on my Samsung S3 (Android 4.1.2) inside the app. No problem on iPhones, too.

还有其他人认识到这种奇怪的行为吗?(也许能够修复它?;-))

Anyone else recognized this strange behavior? (and maybe was able to fix it? ;-) )

推荐答案

使用 的临时解决方案scirra.com

last_click_time = new Date().getTime();
document.addEventListener('click', function (e) {
    click_time = e['timeStamp'];
    if (click_time && (click_time - last_click_time) < 1000) {
        e.stopImmediatePropagation();
        e.preventDefault();
        return false;
    }
    last_click_time = click_time;
}, true);

这篇关于带有 Android 4.2 的 Phonegap 2.4.0 - 奇怪的双击行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆