【问题标题】:Cannot show Popup with jQuery Mobile 1.3.1无法使用 jQuery Mobile 1.3.1 显示弹出窗口
【发布时间】:2013-06-30 00:51:59
【问题描述】:

我试图弹出一个非常简单的“你确定吗?” jQuery Mobile 中的弹出窗口。但是如果我在按钮上使用data-rel="popup",什么也不会发生。如果我删除 data-rel 它会打开 - 但作为一个完整的窗口。逻辑运行良好,但我仍然希望看到一个弹出窗口。

这是代码(简化了 - 我删除了其他页面、标题、html 等 - 除了这个问题之外,该应用程序运行良好,因此无需调试这些)。要查看的 2 个元素是按钮“clearHistory”和弹出窗口本身“history”:

<!-- history page -->
<div data-role="page" id="history">
    <div data-role="header" data-position="fixed">
        <a href="#" data-role="button" data-rel="back" data-icon="arrow-l" data-iconpos="notext">Back</a>
        <h1>History</h1>
        <a href="#deletePopup" data-role="button" data-rel="popup" id="clearHistory" data-icon="delete" data-iconpos="notext" data-theme="d">Delete</a>
    </div><!-- /header -->

    <div data-role="content">
        <ul data-role="listview" id="historyList" data-inset="true" data-theme="f"></ul>
        <h4 id="historyEmpty">History is empty</h4>
    </div><!-- /content -->

    <div data-role="footer" data-position="fixed">
        <h4><a class="ttg" href="http://www.TravelingTechGuy.com" rel="external" target="_blank">Traveling Tech Guy</a></h4>
    </div><!-- /footer -->       
</div>
<!-- end history page -->

<!-- delete history popup -->
<div data-role="popup" id="deletePopup" data-overlay-theme="a" data-theme="c" data-dismissible="false">
    <div data-role="header" data-theme="a">
        <h1>Delete History?</h1>
    </div>
    <div data-role="content" data-theme="d">
        <h3>Delete all items in history?</h3>
        <a href="#" data-role="button" data-inline="true" data-rel="back" data-theme="b">Cancel</a>
        <a href="#" data-role="button" data-inline="true" data-rel="back" data-theme="d" id="deleteHistory">Delete</a>
    </div>
</div>
<!-- delete history popup -->

知道我在这里缺少什么吗?

【问题讨论】:

    标签: javascript html jquery-mobile mobile popup


    【解决方案1】:

    &lt;div data-role=page&gt; 中放置弹出窗口,并且该 div 应该是弹出 div 的直接父级。我在下面的演示中放在&lt;div data-role=content&gt; 之前。

    Demo

    对话框应该放在&lt;div data-role=page&gt; 之外,因为它们被视为一个页面。

    【讨论】:

    • @TravelingTechGuy de nada :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-30
    • 2013-02-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多