如何以正确的方式在 jQuery Mobile 中使用 FastClick? [英] How to use FastClick with jQuery Mobile the right way?

查看:16
本文介绍了如何以正确的方式在 jQuery Mobile 中使用 FastClick?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 iOS 应用程序中使用 FastClick.我下载了 fastclick 并将其包含在我的标题中,如下所示:

i would like to use FastClick in an Application for iOS. I downloaded the fastclick and included it into my header which looks like:

<meta name="format-detection" content="telephone=no" />
   <meta charset="utf-8" />
   <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1" />
    <link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.4.2.css" />
    <link rel="stylesheet" type="text/css" href="css/stylesheet.css" />
    <script type="text/javascript" src="js/jquery-1.11.1.js"></script>
    <script type="text/javascript" src="js/jquery.mobile-1.4.2.js"></script>
    <script type="text/javascript" src="js/fastclick.js"></script>
    <script type="text/javascript" src="js/jquery.simpleWeather.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>

现在我直接在 body 标签上方添加了脚本:

Now i added the script directly above my body tag:

<script>
   $(function() {
   FastClick.attach(document.body);
   });
</script>

但我还没有消除 300 毫秒的延迟……它仍然存在.我用错了吗?

But i haven't eliminated the 300ms delay... its still there. Do i use it the wrong way?

推荐答案

您不需要使用 Fastclick 等 3rd 方插件.

You don't need to use 3rd party plugins like Fastclick.

jQuery Mobile 已经通过 vclick 事件解决了这个问题.它适用于桌面和移动设备,没有 300 毫秒的延迟.

jQuery Mobile has already solved this problem with vclick event. It works on desktop and mobile devices and don't have 300ms delay.

阅读我的其他回答如果您想了解更多信息.

Read my other answer if you want to find out more.

$(document).on('vclick', '#someButton', function(){ 

});

这篇关于如何以正确的方式在 jQuery Mobile 中使用 FastClick?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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