javascript - 页面外的 JQuery Mobile Popover

标签 javascript jquery jquery-mobile

我正在尝试在 jQuery Mobile 中创建一个全局弹出窗口,其中包含一些警报。那可能吗?似乎弹出窗口必须位于 jquery 移动页面中才能访问。我假设这是因为该页面之外的所有内容都不可见。

这是我正在谈论的一个例子。如何让第二个版本正常工作?

作品

<div data-role="page" data-theme="a">
    <div data-role="content">

        <a href="#alert-popup" data-rel="popup" data-role="button" data-inline="true">Popup with close button right</a>

        <div data-role="popup" id="alert-popup" data-theme="c">
            <a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a>
            <h1>Alert Title</h1>
            <p>
                Freegan thundercats raw denim adipisicing elit. 8-bit hella lomo do irony, sartorial aliquip wes anderson. Elit quinoa consectetur hoodie, bushwick 3 wolf moon godard eiusmod next level quis echo park. Keytar ullamco exercitation salvia, brunch before they sold out cray minim echo park polaroid vegan cliche reprehenderit vero synth. Artisan VHS fanny pack aliqua ex williamsburg duis. Reprehenderit chillwave skateboard post-ironic, food truck ethical est wes anderson letterpress incididunt master cleanse. Selvage farm-to-table elit vinyl jean shorts, consectetur delectus non banksy.
            </p>
        </div>

    </div>
</div>

不起作用

<div data-role="page" data-theme="a">
    <div data-role="content">

        <a href="#alert-popup" data-rel="popup" data-role="button" data-inline="true">Popup with close button right</a>

    </div>
</div>



<div data-role="popup" id="alert-popup" data-theme="c">
    <a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a>
    <h1>Alert Title</h1>
    <p>
        Freegan thundercats raw denim adipisicing elit. 8-bit hella lomo do irony, sartorial aliquip wes anderson. Elit quinoa consectetur hoodie, bushwick 3 wolf moon godard eiusmod next level quis echo park. Keytar ullamco exercitation salvia, brunch before they sold out cray minim echo park polaroid vegan cliche reprehenderit vero synth. Artisan VHS fanny pack aliqua ex williamsburg duis. Reprehenderit chillwave skateboard post-ironic, food truck ethical est wes anderson letterpress incididunt master cleanse. Selvage farm-to-table elit vinyl jean shorts, consectetur delectus non banksy.
    </p>
</div>

最佳答案

您是对的,请参阅here :

A popup div has to be nested inside the same page as the link.

<div data-role="page" data-theme="a">
    <div data-role="content">
        <a href="#alert-popup" data-rel="popup" data-role="button" data-inline="true">Popup with close button right</a>
    </div>
    <div data-role="popup" id="alert-popup" data-theme="c">
        <a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a>
        <h1>Alert Title</h1>
        <p>
            Freegan thundercats raw denim adipisicing elit. 8-bit hella lomo do irony, sartorial aliquip wes anderson. Elit quinoa consectetur hoodie, bushwick 3 wolf moon godard eiusmod next level quis echo park. Keytar ullamco exercitation salvia, brunch before they sold out cray minim echo park polaroid vegan cliche reprehenderit vero synth. Artisan VHS fanny pack aliqua ex williamsburg duis. Reprehenderit chillwave skateboard post-ironic, food truck ethical est wes anderson letterpress incididunt master cleanse. Selvage farm-to-table elit vinyl jean shorts, consectetur delectus non banksy.
        </p>
    </div>
</div>

<强> EXAMPLE

关于javascript - 页面外的 JQuery Mobile Popover,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12713505/

相关文章:

javascript - 我的 Modal 无法在 Bootstrap 中工作,看不出出了什么问题

javascript - 使用动画一次滑动超过 1 个 img

javascript - 如何将 Material Design Lite 中的 FAB 按钮与混合移动应用程序中的 jQuery 移动代码集成?

jquery-mobile - 将按钮添加到可折叠集合并获取可折叠元素的值

javascript - 无法通过jQuery模拟点击加载窗口

javascript - Div 元素不会保持所需的纵横比

javascript - 使用 jQuery 获取浏览器 URL

css - 避免导航栏文本被截断

javascript - 在 JavaScript 中操作视频时间戳

javascript - 理解 TypeScript/Angular JS 中的定义顺序