似乎jQuery mobile正在启动页面附加加载消息.我真的不知道发生了什么,但考虑以下简单的片段:
<!DOCTYPE html>
<html>
<head>
<title>sadFace</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta charset="utf-8" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
</head>
<body>
<h1>;__;</h1>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我甚至需要向下滚动才能看到加载消息.所以我认为它可能会发生因为我没有遵循典型的jQuery移动页面解剖,但是:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>;_;</h1>
</div><!-- /header -->
<div data-role="content">
<p>Same shit, different page.</p>
</div><!-- /content -->
<div data-role="footer">
<h4><a href="http://www.google.com/pacman/">need cookies :C</a></h4>
</div><!-- /footer -->
</div><!-- /page -->
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
相同.我对这种行为感到震惊.即使我从上周开始我的项目并且它看起来很好,我也测试jQuery1.0rc2具有相同的结果.到底是怎么回事<.<
查看jQuery Mobile'js我认为这initializePage: function()是对消息的负责.我可以评论出来
//cue page loading message
$.mobile.showPageLoadingMsg();
Run Code Online (Sandbox Code Playgroud)
或设置,autoInitializePage: false但我更喜欢一个不涉及修改的jQuery文件的解决方案(除非它是一个错误).
Ger*_*ine 38
你也必须添加CSS,然后就可以了:
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
Run Code Online (Sandbox Code Playgroud)
详细地:
它总是将以下HTML放在您身体的底部:
<div class='ui-loader ui-body-a ui-corner-all'><span class='ui-icon ui-icon-loading spin'></span><h1></h1></div>
Run Code Online (Sandbox Code Playgroud)
这是相关的CSS(如果你愿意,也许你可以自己玩它)
.ui-loading .ui-loader { display: block; }
.ui-loader { display: none; position: absolute; opacity: .85; z-index: 100; left: 50%; width: 200px; margin-left: -130px; margin-top: -35px; padding: 10px 30px; }
Run Code Online (Sandbox Code Playgroud)
该函数showPageLoadingMsg将CSS类'.ui loading'添加到HTML标记,然后它变得可见
Ada*_*ore 18
您可以在加载jquery-mobile库之前使用以下内容停止autoInitializePage
jQuery(document).on("mobileinit", function() {
jQuery.mobile.autoInitializePage = false;
});
Run Code Online (Sandbox Code Playgroud)
更多信息:http://api.jquerymobile.com/global-config/
| 归档时间: |
|
| 查看次数: |
25408 次 |
| 最近记录: |