作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试学习如何一起使用 jQuery mobile 和phonegap。我有以下基本索引页:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.external-png-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.icons-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.inline-png-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.inline-svg-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.structure-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.theme-1.4.3.css" />
<title>UIAdv</title>
</head>
<body>
<div class="app">
<h1>Welcome to UIAdv</h1>
<a href="#" class="ui-btn ui-btn-inline">Anchor</a>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.4.3.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
app.initialize();
</script>
</body>
</html>
其中我有以下行,应该使用 jquery 库呈现按钮:
<a href="#" class="ui-btn ui-btn-inline">Do Something</a>
当使用phonegap run ios运行应用程序并且构建成功时,我得到附加的图像输出:
而按钮应该如下所示:
当我在浏览器中打开index.html(在phonegap应用程序的目录中)时,我在控制台中看到以下内容:
我猜这就是导致问题的原因。我需要你的支持来解决这个第一次遇到的问题(对我自己)。我下载了所有 jQuery mobile zip 文件,并将所有文件放置在 PhoneGap 应用程序的相应文件夹中。
谢谢
最佳答案
cordova.js
脚本标记应位于 header 中。此外,您还需要检查应用程序的 www
目录中是否存在 cordova.js
文件。我已经重写了html文件。您可以使用下面的代码来测试您的 jquery 移动应用程序。快乐编码!
<html>
<head>
<title>UIAdv</title>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<!-- link rel="stylesheet" type="text/css" href="css/index.css" /-->
<link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.external-png-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.icons-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.inline-png-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.inline-svg-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.structure-1.4.3.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.theme-1.4.3.css" />
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.4.3.js"></script>
<!-- script type="text/javascript" src="js/index.js"></script -->
<!-- script type="text/javascript"> app.initialize(); </script -->
</head>
<body>
<div class="app">
<h1>Welcome to UIAdv</h1>
<a href="#" class="ui-btn ui-btn-inline">Anchor</a>
</div>
</body>
</html>
关于javascript - jquery mobile 未在phonegap 应用程序中加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25044864/
我是一名优秀的程序员,十分优秀!