我正在寻找一个简单的示例,展示如何使用JQueryMobile呈现已在客户端动态组装的页面。 $ .mobile.autoInitialize以前用过几个版本,现在我们有$ .mobile.autoInitializePage,但我似乎无法弄清楚如何做或找到使用它的人的任何例子。
我尽力而为(现在正在工作 - 过早地调用设置autoInitializePage):
<html>
<head>
<link class="jsbin" href="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.css" rel="stylesheet" type="text/css" />
<script class="jsbin" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script class="jsbin" src="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.js"></script>
<script>
$.mobile.autoInitializePage = false
</script>
</head>
<body>
</body>
<!-- coffeescript makes multiline strings easy -->
<script src="http://jashkenas.github.com/coffee-script/extras/coffee-script.js"></script>
<script type='text/coffeescript'>
$('body').html "
<div data-role='page'>
<div data-role='header'><h1>Title</h1></div>
<div data-role='content'><p>Page content goes here.</p></div>
<div data-role='footer'><h4>Page Footer</h4></div>
</div>
";
$.mobile.initializePage();
</script>
</html>
结果在此处:http://jsbin.com/apocol/2 在这里搞清楚:http://jsbin.com/apocol/2/edit#html
答案 0 :(得分:1)
我不确定性能影响或其他可能的问题,但是当我想强制完全刷新时,我已经成功地使用了动态更新的页面。
$("#MyPage").page("destroy").page();