2013-04-22 74 views
0

嘗試學習彈出窗口並發現JQM彈出窗口「對話框」示例不起作用 - 當我按下按鈕「刪除頁面...」時不會顯示任何內容。 我的HTML的身體是:JQM彈出窗口示例不起作用

<div data-role="page" id="page_test1" data-theme="b"> 

<div data-role="content"> 
    <a href="#popupDialog" data-rel="popup" data-position-to="window" data-role="button" data-inline="true" data-transition="pop" data-icon="delete" data-theme="b">Delete page...</a> 
    </div> <!-- /content --> 
</div> <!-- /page --> 

<!-- Exactly copied from http://view.jquerymobile.com/1.3.1/dist/demos/widgets/popup/ (sample "Dialog") --> 
<div data-role="popup" id="popupDialog" data-overlay-theme="a" data-theme="c" data-dismissible="false" style="max-width:400px;" class="ui-corner-all"> 
    <div data-role="header" data-theme="a" class="ui-corner-top"> 
     <h1>Delete Page?</h1> 
    </div> 

    <div data-role="content" data-theme="d" class="ui-corner-bottom ui-content"> 
     <h3 class="ui-title">Are you sure you want to delete this page?</h3> 
     <p>This action cannot be undone.</p> 
     <a href="#" data-role="button" data-inline="true" data-rel="back" data-theme="c">Cancel</a> 
     <a href="#" data-role="button" data-inline="true" data-rel="back" data-transition="flow" data-theme="b">Delete</a> 
    </div> <!-- content --> 
</div> <!-- popup --> 

正如你看到的,我的HTML的部分是有點。 你可以在這裏找到彈出這樣的行爲 - http://jsfiddle.net/vbulash/YkEAj/

回答

1

彈出窗口必須在data-role="page"容器內。

<div data-role="page" id="page_test1" data-theme="b"> 
    <div data-role="content"> <a href="#popupDialog" data-rel="popup" data-position-to="window" data-role="button" data-inline="true" data-transition="pop" data-icon="delete" data-theme="b">Delete page...</a> 

    </div> 
    <!-- /content --> 
    <!-- Exactly copied from http://view.jquerymobile.com/1.3.1/dist/demos/widgets/popup/ (sample "Dialog") --> 
    <div data-role="popup" id="popupDialog" data-overlay-theme="a" data-theme="c" data-dismissible="false" style="max-width:400px;" class="ui-corner-all"> 
     <div data-role="header" data-theme="a" class="ui-corner-top"> 
       <h1>Delete Page?</h1> 

     </div> 
     <div data-role="content" data-theme="d" class="ui-corner-bottom ui-content"> 
       <h3 class="ui-title">Are you sure you want to delete this page?</h3> 

      <p>This action cannot be undone.</p> <a href="#" data-role="button" data-inline="true" data-rel="back" data-theme="c">Cancel</a> 
    <a href="#" data-role="button" data-inline="true" data-rel="back" data-transition="flow" data-theme="b">Delete</a> 

     </div> 
     <!-- content --> 
    </div> 
    <!-- popup --> 
</div> 
<!-- /page --> 

http://jsfiddle.net/YkEAj/1/

+0

非常感謝,jgillich。 它的工作! – 2013-04-22 07:38:13

+0

同時,彈出窗口小部件描述不包含關於我們應該在哪裏放置彈出窗格的通知 – 2013-04-22 07:39:15

相關問題