在 jQuery Mobile 的情况下,几乎没有解决方案,但有一个适用于您的情况。
解决方案 1 - jQuery 解决方案
您应该使用 touchstart 事件而不是点击事件。它像点击一样工作,同时它是在屏幕滑动期间触发的第一个事件。
这是一个代码示例:
$(document).on('pagebeforeshow', '#index', function(){
$(document).on('touchstart', '#index', function(){
alert('touchstart');
});
});
我给你做了一个工作的例子:http: //jsfiddle.net/Gajotres/vDqdD/
解决方案 2 - jQuery Mobile 解决方案
虽然 touchstart 是一个很好的全方位解决方案,但它不适用于使用旧 jQuery Mobile 版本(1.1 及以下)的旧 Android 设备。
因此,如果您需要创建防弹版本,您应该使用vmousedown事件而不是 touchstart。
$(document).on('pagebeforeshow', '#index', function(){
$(document).on('vmousedown', '#index', function(){
alert('vmousedown');
});
});
这是一个有效的 jsFiddle 示例:http: //jsfiddle.net/Gajotres/vDqdD/4/