3

我正在尝试使用 jquery mobile 指定的 touchend (或 taphold 事件,两者都不会触发)。我正在使用 phonegap 平台为 android 开发应用程序。我的 AVD 运行 Android 4.0.3,我的 phonegap 版本是 1.3.0。

由于我使用phonegap,我正在用javascript编码,目的是在长按一个单词后使用以下代码恢复用户选择的文本。

var selectAction = function(){
    LOGGER.log('event.js : selectAction');
};

function selectMobile(component){
    component.addEventListener('touchend',selectAction,false);
}

它实际上工作正常,如果我相对较快地点击,事件将启动并且我可以获得日志消息。但是,快速触摸不会选择文本(我有更多代码获取所选文本,但这不是问题)

当用户在 Android 中长按时,会弹出一个默认的“操作菜单”,这似乎阻止了进一步的事件触发。Because of that, I never get into my selectAction when actual text is selected.

有人知道如何在 Android 平台上的 html/javascript 中正确获取选定的文本吗?

非常感谢。

4

1 回答 1

7

这可能与以下错误有关。 http://code.google.com/p/android/issues/detail?id=19827

尝试 catch touchmove 并调用 e.preventDefault()

于 2012-06-01T10:38:51.797 回答