历史记录为false的JQuery Mobile弹出窗口自动关闭 [英] JQuery Mobile popup with history=false autocloses

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

问题描述

我正在尝试显示一个弹出窗口,但是该弹出窗口会自动消失,而没有history = false的弹出窗口仍然可见,但是在关闭该弹出窗口时,会触发浏览器后退动作

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>

检查此处发生的情况: http://jsfiddle.net/francisdb/ThtfZ/

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

关于如何解决此问题的任何想法?

Any idea on how to fix this?

推荐答案

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

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

Webkit浏览器讨厌打开弹出窗口,因此需要使用setinterval来触发它.同样的事情也适用于其他jQuery Mobile功能.

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

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

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