Jquery mobile phonegap和x2B上的touchstart;android设备上的jquery mobile

Jquery mobile phonegap和x2B上的touchstart;android设备上的jquery mobile,jquery-mobile,Jquery Mobile,我有这个 <a href="A.html" data-ajax="false" class="btn">A</a> <a href="B.html" data-ajax="false">B</a> <script> $('a, button').bind('touchstart', function(e) { $(this).trigger('click'); e.preventDefault(); }); <

我有这个

<a href="A.html" data-ajax="false" class="btn">A</a>

<a href="B.html" data-ajax="false">B</a>

<script>
$('a, button').bind('touchstart', function(e) {
    $(this).trigger('click');
    e.preventDefault();
});
</script>

$('a,button').bind('touchstart',函数(e){
$(this.trigger('click');
e、 预防默认值();
});
代码在phonegap+jquery mobile上编译,并在Nexus S上测试

我的问题是,当我触及A和B时,我没有看到性能提升,发生了什么


请帮忙

Peter这段代码不会给你提速

您不需要将touchstart绑定到标签上。可以在按钮上使用它。使用touchstart事件触发点击元素没有意义,touchstart是用于替换移动设备上点击事件的事件。但在android用户点击事件的情况下,可以获得更好的性能。Touchstart用于在iPhone/iPad设备上执行JQM

这是我用来确定轻敲事件类型的代码:

var userAgent = navigator.userAgent;
touchEvent = (userAgent.match(/iPad|iPhone/i)) ? "touchstart" : "tap";
无论您选择什么活动,移动设备上都会有300毫秒的deley。一些插件声称他们可以解决这个问题,但我从来没有找到一个成功的

我希望这对你有帮助