1

我按照本指南创建了我的第一个 PhoneGap 应用程序: http ://cleancodedevelopment-qualityseal.blogspot.de/2012/12/first-phonegap-app-with-android-using.html 这很好用。现在,我想在这个应用程序中使用 JQuery Mobile。

我下载了三个文件并将它们放入与我的 index.html 相同的目录中。index.html 的头部如下所示:

<link rel="stylesheet" href="jquery.mobile-1.3.1.min.css" />
<script src="cordova-2.6.0.js"></script>
<script src="jquery.mobile-1.3.1.min.js"></script>
<script src="jquery-1.9.1.min.js"></script>

不工作。当我使用jquery mobile的“在线版”时,像这样:

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>

有用。但我想制作一个离线应用程序。任何想法?

4

1 回答 1

1

您应该在 jQuery Mobile 参考之前添加 jQuery 参考,因为 JQM 在内部使用 jQuery。在 PhoneGap 应用程序中,您不应添加来自 CDN 的引用,因为它会大大减少应用程序的加载时间。

如果您像这样重新排列本地引用,您的代码将起作用。

<link rel="stylesheet" href="jquery.mobile-1.3.1.min.css" />
<script src="cordova-2.6.0.js"></script>
<script src="jquery-1.9.1.min.js"></script>
<script src="jquery.mobile-1.3.1.min.js"></script>
于 2013-04-19T13:33:01.447 回答