带有 history=false 的 JQuery Mobile 弹出窗口会自动关闭 [英] JQuery Mobile popup with history=false autocloses

查看:33
本文介绍了带有 history=false 的 JQuery Mobile 弹出窗口会自动关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试显示一个弹出窗口,但弹出窗口会自动消失,如果没有 history=false,弹出窗口仍然可见,但在关闭弹出窗口时,会触发浏览器返回操作

<div data-role="popup" data-history="false" id="appPopup">test popup</div><脚本>$("#indexpage").on("pageshow", function () {$("#appPopup").popup("open");});

检查这里发生了什么:http://jsfiddle.net/francisdb/ThtfZ/

知道如何解决这个问题吗?

解决方案

工作示例:http://jsfiddle.net/Gajotres/2EL5R/

$("#indexpage").on("pageshow", function () {var popup = setInterval(function(){$("#appPopup").popup("open");清除间隔(弹出);},1);});

Webkit 浏览器讨厌弹出窗口,因此需要使用 setinterval 来触发它.其他一些 jQuery Mobile 功能也是如此.

I'm trying to show a popup but the popup disappears automatically, without the history=false the popup stays visible but then on closing the popup the browser back action is triggered

<div data-role="page" id="indexpage">
    <div data-role="popup" data-history="false" id="appPopup">test popup</div>
    <script>
    $("#indexpage").on("pageshow", function () {
        $("#appPopup").popup("open");
    });
    </script>
</div>

Check what happens here: http://jsfiddle.net/francisdb/ThtfZ/

Any idea on how to fix this?

解决方案

Working example: http://jsfiddle.net/Gajotres/2EL5R/

$("#indexpage").on("pageshow", function () {
    var popup = setInterval(function(){
        $("#appPopup").popup("open");
        clearInterval(popup);
    },1);
});

Webkit browsers hate popup open, so setinterval needs to be used to trigger it. Same thing goes for a few other jQuery Mobile functionalities.

这篇关于带有 history=false 的 JQuery Mobile 弹出窗口会自动关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆