Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Jquery和jgestures在Cordova中刷卡_Jquery_Swipe Gesture - Fatal编程技术网

使用Jquery和jgestures在Cordova中刷卡

使用Jquery和jgestures在Cordova中刷卡,jquery,swipe-gesture,Jquery,Swipe Gesture,当涉及到使用jQuery/jQuery mobile刷卡时,Stackoverflow中有很多主题。然而,它们似乎都没有以我想要的方式工作。以下是我的phonegap应用程序的索引页结构。根据主题推荐,我尝试了jgestures插件 <html> <head> <title>App</title> <script type="text/javascript" src="lib/cordova-2.2.0.js"></script&

当涉及到使用jQuery/jQuery mobile刷卡时,Stackoverflow中有很多主题。然而,它们似乎都没有以我想要的方式工作。以下是我的phonegap应用程序的索引页结构。根据主题推荐,我尝试了jgestures插件

<html>
<head>
<title>App</title>
<script type="text/javascript" src="lib/cordova-2.2.0.js"></script>
<script type="text/javascript" src="lib/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="lib/jgestures.js"></script>
</head>
<body>
<div id="home">
    <div id="headersec">
        <!-- some elements like images here-->
    </div>
    <div id="screen1">
        <!-- three 80x80 images go here -->
    </div>
    <div id="screen2">
        <!-- three other 80x80 images go here-->
    </div>
</div>
</body>
</html>
但是我尝试过的任何示例代码都不适用于此。。谁知道我做错了什么

看起来问题也有类似的问题。解决方案是这样做:

document.addEventListener("deviceready", function(){
    $('#screen1').bind('swipeleft',showNext); //show next hides screen1, shows screen2 
    $('#screen2').bind('swiperight',showPrev);//show prev hides screen2, shows screen1
},false);

或者,您可能只需要在调用事件侦听器之前定义函数
ondevicerady

此代码与问题中的代码没有区别。内联或单独定义函数没有任何区别。解决办法是什么?
document.addEventListener("deviceready", function(){
    $('#screen1').bind('swipeleft',showNext); //show next hides screen1, shows screen2 
    $('#screen2').bind('swiperight',showPrev);//show prev hides screen2, shows screen1
},false);