我在使jquery mobile正常工作时遇到一些问题。我正在使用the anatomy of a page和this stackoverflow example。
我期望的输出是jqm仅显示代码中第一个数据角色的内容。但是,实际发生的是在装入jqm之后,它将视图设置为浏览器窗口的大小,但仍显示第二个数据角色的内容以及其下方的“正在加载”字样。
我很确定我缺少一些非常简单的东西。任何帮助将不胜感激。
我正在使用PhoneGap和RequireJS。
这是代码:index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<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/app.css" />
<title>Student Picker</title>
</head>
<body>
<div data-role="page" id="test1">
<a href="#test2">Goto Test2</a>
</div>
<div data-role="page" id="test2">
<a href="#test1">Goto Test1</a>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="require.js"></script>
<script type="text/javascript" src="main.js"></script>
</body>
</html>
main.js
require.config({
baseUrl: 'js',
paths: {
'jquery': 'jquery',
'jquery.mobile.config': 'jquery.mobile.config',
'jquery.mobile': 'jquery.mobile',
'app': 'app'
},
map: {
'*': {'jquery': 'jquery-private'},
'jquery-private': { 'jquery': 'jquery' }
},
shim: {
'jquery.mobile.config': ['jquery'],
'jquery.mobile': ['jquery', 'jquery.mobile.config']
}
});
require(['jquery', 'app', 'jquery.mobile'], function(jq, app) {
jq(function() {
//app.initialize();
});
});
jquery.mobile.config
define(['jquery'], function (jq) {
jq(document).on("mobileinit", function () {
jq.mobile.ajaxEnabled = false;
jq.mobile.linkBindingEnabled = false;
jq.mobile.hashListeningEnabled = false;
jq.mobile.pushStateEnabled = false;
});
});
输出图片:
无论是否带有jqm配置文件,结果都是相同的。如果您需要更多信息,请随时发表评论:)
最佳答案
代码中缺少与JQM文件相对应的CSS文件。
添加CSS文件,它应该可以正常工作,因为“ data-role”可以用作CSS选择器。
关于javascript - 数据 Angular 色在jqm中仅显示一页,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28492536/