2013-02-21 35 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); 
});