jquery-mobile - 在JQueryMobile中使用autoInitializePage的示例

标签 jquery-mobile

我正在寻找一个简单的示例,该示例演示如何使用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

最佳答案

我不确定性能的影响或其他可能的陷阱,但是当我要强制进行完全刷新时,已将其成功用于动态更新的页面。

$("#MyPage").page("destroy").page();

关于jquery-mobile - 在JQueryMobile中使用autoInitializePage的示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7291110/

相关文章:

jquery - Phonegap jQuery Mobile 背景 CSS 问题 - 屏幕底部 1px

javascript - 如何在 JQM 中为不同页面制作页码页眉

javascript - 隐藏目标 div 后点击事件冒泡

javascript - 将文本值保存到 ListView 并开始计时

javascript - 如何处理 jQuery Mobile 中的字符串本地化?

javascript - JQuery Mobile Javascript 复杂方程

jquery - 处理表单发布、nodejs 和 JQueryMobile

javascript - 手机按键不灵?

jquery - 如何在 Knockout 模板中设置 jQuery Mobile 内容的样式?

jquery mobile选择填充剩余空间