Skip to main content
 首页 » 编程设计

jquery-mobile之jQuery Mobile 对话框和 Backbone js

2025年12月25日33jillzhang

我有一个使用 jquery mobile 的主干应用程序。我正在尝试使用对话框弹出窗口,但问题是当我单击链接#popupSuccess 时它不会激活模态,因为我假设 Backbone 正在捕获它。有什么想法吗?

这是我的模态代码

<a class="modalLink" id="modalSuccessTrigger" href="#popupSuccess" data-rel="popup" data-position-to="window" data-role="button" data-inline="true" data-transition="pop" data-icon="delete" data-theme="b">Success</a> 
 
<div data-role="popup" id="popupSuccess" data-overlay-theme="a" data-theme="c" data-dismissible="false" style="max-width:400px;" class="ui-corner-all modalLinkCont"> 
    <div data-role="header" data-theme="a" class="ui-corner-top"> 
        <h1>Correct!</h1> 
    </div> 
    <div data-role="content" data-theme="d" class="ui-corner-bottom ui-content" style="background-color:white"> 
        <h3 class="ui-title">That is correct. Tap to continue to level 2</h3> 
        <a href="#" data-role="button" data-inline="true" data-rel="back" data-transition="flow" data-theme="b">Contineu</a> 
    </div> 
</div> 

请您参考如下方法:

您需要以编程方式启动弹出窗口:

在你的主干 View 中:

events: { 
   'click #modalSuccessTrigger': 'openPopUp' 
}, 
 
openPopUp: function(e) { 
   e.preventDefault() 
   $('#modalSuccessTrigger').popup('open') 
} 

有关更多详细信息,请参阅文档:http://jquerymobile.com/demos/1.2.0-alpha.1/docs/pages/popup/index.html