Android 如何在apache cordova中完成页面滑动

Android 如何在apache cordova中完成页面滑动,android,cordova,mobile,touchswipe,Android,Cordova,Mobile,Touchswipe,我正在apache cordova上构建一个移动应用程序。我使用的是最新版本9.0.0(cordova-lib@9.0.1). 我已经创建了index.html 代码在cordova浏览器上非常有效。但它不能在android设备上运行。我没有检查模拟器,因为我的系统不支持模拟器(可以说硬件加速失败)。 所以我在我的android手机上安装了apk。但是这个应用程序不起作用。 这是我的密码:- Index.html <!DOCTYPE html> <html> <he

我正在apache cordova上构建一个移动应用程序。我使用的是最新版本9.0.0(cordova-lib@9.0.1). 我已经创建了index.html 代码在cordova浏览器上非常有效。但它不能在android设备上运行。我没有检查模拟器,因为我的系统不支持模拟器(可以说硬件加速失败)。 所以我在我的android手机上安装了apk。但是这个应用程序不起作用。 这是我的密码:-

Index.html

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet"
  href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script
  src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
<script src="js/swipe.js"></script>  
</head>
<body>
  <div data-role="page" id="firstpage">
    <div data-role="header">
      <h1>Swipe Left</h1>
    </div>
    <div data-role="content">
      <p>Swipe Left to get to the next page.</p>
    </div>
  </div>
  <div data-role="page" id="secondpage">
    <div data-role="header">
      <h1>Swipe Right</h1>
    </div>
    <div data-role="content">
      <p>Swipe Right to get to the next page.</p>
    </div>
  </div>

</body>
</html>
有人会建议如何在ApacheCordova中实现页面滑动吗

我想要什么? 我想通过在手机屏幕上滑动手指进入下一页(或div)

我已经搜索了所有的网页,但代码可以在浏览器中运行,但不能在android设备上运行


任何帮助都将不胜感激。

您应该使用Chrome Device Inspector调试手机上运行的应用程序


无论如何,请尝试将您的JS和CSS资源移动到本地路径,以便将它们嵌入应用程序中,可能由于安全策略,它们的下载被阻止。

您应该使用Chrome Device Inspector调试手机上运行的应用程序


无论如何,请尝试将您的JS和CSS资源移动到本地路径,以便将它们嵌入到应用程序中,可能由于安全策略,它们的下载被阻止。

应用程序在您的android设备上究竟如何不工作?它会崩溃吗?它看起来不对吗?它不会崩溃。但当我向左或向右滑动时,什么也没发生。我在cordova浏览器上试过了。当我向左拖动鼠标时,将显示第二页。当我向右拖动鼠标时,将显示第一页。但当我在安卓手机上刷卡时,这种情况不会发生。这个应用程序在你的安卓设备上究竟是如何不工作的?它会崩溃吗?它看起来不对吗?它不会崩溃。但当我向左或向右滑动时,什么也没发生。我在cordova浏览器上试过了。当我向左拖动鼠标时,将显示第二页。当我向右拖动鼠标时,将显示第一页。但当我在安卓手机上刷卡时,这种情况不会发生。
$(document).delegate("#firstpage", 'pageinit', function (evt) {
    $(this).bind("swipeleft", function (e) {
        $.mobile.changePage("#secondpage", {
        });
    });
})

$(document).delegate("#secondpage", 'pageinit', function (evt) {
    $(this).bind("swiperight", function (e) {
        $.mobile.changePage("#firstpage", {
        });
    });
});