刷卡功能不工作使用jquerymobile和phonegap的Android [英] swipe function not working using jquerymobile and phonegap for android

查看:171
本文介绍了刷卡功能不工作使用jquerymobile和phonegap的Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的电话gap.i在eclipse使用phonegap为Android创建应用程序。我添加手机gap.jar和插件在xml文件夹。我已经添加jquery库和phonegap1.1.0 js也。我试图实现滑动功能导航一个页面到另一个页面,但它不工作。任何人都告诉如何解决问题?

I am new to the phonegap .i am creating application in eclipse using phonegap for android .I added phone gap.jar and plugin in xml folder.I have added jquery library and phonegap1.1.0 js also. am trying to implement swipe function to navigate one page to another page but its not working .can anybody tell how to solve the problem?

我在我的活动inex.html中调用
这是我的index.html

I am calling in inex.html in my activity this is my index.html

<html>
    <head>
        <title>sample check</title>
        <link rel="stylesheet" href="www/jquery.mobile/jquery.mobile-1.0rc2.min.css" type="text/css" charset="utf-8" />

        <script type="text/javascript" src="js/fnswipe.js"></script>
        <script type="text/javascript" src="www/jquery.mobile/jquery-1.6.4.min"></script>
        <script type="text/javascript" src="www/jquery.mobile/jquery.mobile-1.0rc2.min.js"></script>
        <script type="text/javascript" charset="utf-8" src="phonegap-1.1.0.js"></script>
    </head>
    <body>
        <div data-role="page" id="home">  
            <div data-role="content"> 
                <p> 
                    <ul data-role="listview" data-inset="true" data-theme="c"> 
                        <li id="listitem">Swipe Right to smple check page</li> 
                    </ul> 
                </p> 
            </div> 
        </div> 
    </body>
</html>

这是我的js文件

$("#listitem").swiperight(function() { 
    $.mobile.changePage("file:///android_asset/www/samplecheck.html"); 
}); 

感谢您的帮助

推荐答案

我有同样的问题,所有滑动事件除了在Android上工作。为了解决这个问题,我不得不设置Swipe事件的阈值。您可以在您的JS文件中调用滑动事件之前设置它们。为了获得最佳效果,我有我的设置:

I was having the same issue, all swipe events were working except for on Android. To solve the issue I had to set the Threshold values for the Swipe events. You can set them just before you call your swipe events in your JS file. For best results I have mine set to:

$.event.special.swipe.scrollSupressionThreshold = 10; // More than this horizontal displacement, and we will suppress scrolling.
$.event.special.swipe.horizontalDistanceThreshold = 30; // Swipe horizontal displacement must be more than this.
$.event.special.swipe.durationThreshold = 500;  // More time than this, and it isn't a swipe.
$.event.special.swipe.verticalDistanceThreshold = 75; // Swipe vertical displacement must be less than this.

这个答案帮助了我很多:在jquery mobile中垂直滚动期间触发swipeleft / swiperight

This answer helped me a lot : swipeleft/swiperight triggered during vertical scroll in jquery mobile

以及文档:活动 - >触摸活动 - >滑动 a>

希望这有助于!

这篇关于刷卡功能不工作使用jquerymobile和phonegap的Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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