在jQuery mobile中,tap和vclick之间的区别是什么? [英] In jQuery mobile, what's the diff between tap and vclick?

查看:284
本文介绍了在jQuery mobile中,tap和vclick之间的区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该使用哪个事件来聆听?
为什么要使用vclick?并且我只是不知道使用哪种情况。

which event should i use to listen to ? why use vclick? and I just don't know which situation to use which.

推荐答案

在jQuery Mobile Tap的情况下,设备。

In case of jQuery Mobile Tap used to work only on mobile devices. This is not case any more.

VClick是为了弥补桌面/移动设备之间的点击/点按不兼容性而创建的。

VClick was created to bridge a gap between click/tap incompatibility among desktop/mobile devices.

现在天你自由使用水龙头,但有几个问题。在iOS平台上点击将失败。应该使用touchstart。

Now days you case freely use tap but there are few problems. Tap will fail on iOS platform. Touchstart should be used instead.

示例:


  • Android 4.1.1 - 无延迟

  • iOS - 无延迟

  • 桌面Firefox 19& Chrome 25.0.1364.152 - 无延迟

http://jsfiddle.net/Gajotres/PYPXu/embedded/result/

$(document).on('pagebeforeshow', '#index', function(){       
    $( document ).on( "vclick", '[data-role="page"]', function() {
        $( this ).append( "<span style='color:#00F;'>vmouseup fired.</span>" );
    });
});

点按:

它只能在移动设备上工作,现在也可以在桌面浏览器上使用,但在jQuery Mobile 1.1及以下版本的iOS上会失败。

It used to work only on a mobile devices, now works also on a desktop browsers, but will fail on a iOS with a jQuery Mobile version 1.1 and below.


  • Android 4.1.1 - 无延迟

  • iOS - 无延迟

  • 桌面Firefox 19& Chrome 25.0.1364.152 - 无延迟

http ://jsfiddle.net/Gajotres/k8kSA/

$(document).on('pagebeforeshow', '#index', function(){       
    $( document ).on( "tap", '[data-role="page"]', function() {
        $( this ).append( "<span style='color:#00F;'>tap fired.</span>" );
    });
});



点击



和桌面浏览器。

Click

Will work on mobile devices and desktop browsers.


  • Android 4.1.1 - 可见延迟(300+ ms)

  • iOS - 无延迟

  • 桌面Firefox 19& Chrome 25.0.1364.152 - 无延迟

http ://jsfiddle.net/Gajotres/L2FHp/

$(document).on('pagebeforeshow', '#index', function(){       
    $( document ).on( "click", '[data-role="page"]', function() {
        $( this ).append( "<span style='color:#00F;'>click fired.</span>" );
    });
});



结论



jQM兼容性标签与 V Click ,在任何其他情况下,使用点按

Conclusion

If you want a backward jQM compatibility stick with VClick, in any other case use Tap.

这篇关于在jQuery mobile中,tap和vclick之间的区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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