2011-09-03 19 views
3

我正在尋找一個簡單的示例,展示如何使用JQueryMobile呈現已在客戶端動態組裝的頁面。 $ .mobile.autoInitialize用於在幾個版本之前工作,現在我們有$ .mobile.autoInitializePage,但我似乎無法弄清楚如何去做或找到任何正在使用它的人的例子。在JQueryMobile中使用autoInitializePage的示例

我盡力而爲(現在這個WORKS - 打電話設定autoInitializePage之前太早):它http://jsbin.com/apocol/2 混亂在這裏:

<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/edit#html

+1

我的問題是,我是設置$ .mobile.autoInitializePage =裝載jQuery Mobile的前假。我現在已經修復它並且它可以工作。 –

回答

1

我不知道的性能影響或其他可能的問題,但我已經成功地將這個動態更新的頁面用於強制完成刷新。

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