【问题标题】:Calling a dialog then goes back to page that called the dialog调用对话框然后返回调用对话框的页面
【发布时间】:2013-07-09 17:18:28
【问题描述】:

我正在使用 jquery-mobile 1.3.0 和 phonegap 2.8.0 从按钮调用对话框页面,事情是按如下方式拨打电话

<div data-role="footer" data-position="fixed" data-theme="a" style="height: 0px; border: 0">
    <a id="btnHail" href="#confirm-address-dialog"  data-theme="e" data-rel="dialog">
                <i class="icon-phone"></i> Pedir Taxi
    </a>
</div>

但是当它第一次被调用时,对话框出现但又回到了上一页。对话框代码如下:

<div data-role="page" id="confirm-address-dialog" data-theme="b">
        <div data-role="header" data-theme="e">
            <h1> Titulo </h1>
        </div>
        <div data-role="content" data-theme="b">
            <p>
                Are sure you want this?
            </p>
            <p>
                <b id="txtDataConfirm"></b>
            </p>
            <button id="btnHailConfirm" data-theme="e">
                <i class="icon-phone"></i> Ok
            </button>
        </div>
        <div data-role="footer" data-position="fixed" data-theme="a">
            <p>footer heading</p>
        </div>

</div>

这发生在 iPhone 4s 上(作为开发者),这个问题永远不会发生在 chrome 或 mozilla 上。我曾尝试使用弹出窗口,但使用弹出窗口有一些限制,它不会显示在我的页脚上。

感谢您的帮助。

【问题讨论】:

  • data-role=dialog 不是page
  • 我试过了,但没有任何改变。它仍然有同样的问题。

标签: ios jquery-mobile dialog cordova


【解决方案1】:

我尝试了很多解决方案,但没有一个奏效。正如我之前所说,我的桌面上的 chrome 或任何浏览器都没有任何问题,但在我的 iPhone 上它不起作用。我发现错误主要在浏览器中。所以我将pushStateEnabled的配置设置为false。我通过执行以下操作来添加此脚本。

<script type="text/javascript">
$(document).bind("mobileinit", function(){
$.mobile.pushStateEnabled = false;
});
</script>

它应该在调用 jquery-mobile 脚本之前添加,更多信息你可以在JQuery description看到它

它解决了问题,不再跳回。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多