【发布时间】:2012-02-25 14:26:32
【问题描述】:
我正在使用 jQuery mobile(和 Phonegap,但以下内容与设备无关)为移动设备编写一个 Html 5 应用程序,使用一个包含各种
元素的 html 页面作为子页面。要在一个子页面和另一个子页面之间切换,我使用 $.mobile.changePage。 一切正常除非我将 div 标签放入其中一个
容器中!
工作示例:
<!DOCTYPE html>
<html>
<head>
<title>App</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
<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>
<script type="text/javascript">
$(document).ready(function() {
$.mobile.changePage($('#page2'), {
transition : 'slideup',
reverse : false,
changeHash : true
});
});
</script>
</head>
<body>
<div data-role="page" id="page1" data-theme="a">
<div data-role="content">
Page1
</div>
</div>
<div data-role="page" id="page2" data-theme="a">
<div data-role="content">
Page2
</div>
</div>
</body>
</html>
现在,在 Page1 后面添加像封闭 div 标签这样简单的东西之后
Page1 -> Page1<div />
$.mobile.changePage 仍然触发 - 可以看到 page2 内容一秒钟 - 但随后显示空白屏幕。
这发生在桌面浏览器和智能手机中(使用 Phonegap 并调整代码)。
我真的很感激任何想法或提示。缩小这个问题的范围并使其可重现使我花费了宝贵的生命时间,因为它似乎不太可能......
【问题讨论】:
标签: jquery-mobile