2013-02-21 39 views
0

我需要在啓動時更改爲不同的頁面,我希望它成爲一個對話框。 這個在1.2中可用,在1.3和IE和FireFox協同工作。 Chrome顯示對話框,然後立即恢復到第一頁。 如果我刪除「角色:對話框」,它適用於每個人。我試過一個隱藏的超鏈接,我強制點擊...相同的結果。 Chrome(最新版本)會恢復到第1頁。JQM 1.3 changePage'角色對話框'在Chrome中失敗

有關如何解決此問題的任何想法?

下面是一個簡化小提琴http://jsfiddle.net/stocksp/P4ZWj/3/

div data-role="page" id="page1"> 
     <div data-role="content"> 
      <h6>page one content</h6> 
     </div> 
    </div> 
    <div data-role="page" id="page2"> 
     <div data-role="header"> 
      <h1 class="title">My DIALOG </h1> 
     </div><!-- /header --> 
     <div data-role="content"> 
      Dialog Content 
     </div> 
    </div> 

$(document).delegate("#page1", "pageinit", function() { 
      $.mobile.changePage('#page2', { transition: 'pop', role: 'dialog' }); 
     }); 

回答

2

快速的解決方法直到這是固定的:包裹changePage方法在的setTimeout ...

$(document).delegate("#page1", "pageinit", function() { 
    setTimeout(function() { 
     $.mobile.changePage('#page2', { transition: 'pop', role: 'dialog' }); 
    }, 100); 
});