jQuery移动弹出窗口未关闭 [英] jQuery mobile popup is not closing

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

问题描述

很抱歉没有提供小提琴,我无法在那里安装它.

sorry for not supplying a fiddle, I can't get it set up there.

但是,我使用以下代码以编程方式打开和关闭弹出窗口.只是它不会关闭并保持打开状态.我在做什么错了?

However, I use the following code to programatically open and close a popup. Only that it doesn't close and stays open. What am I doing wrong?

<!DOCTYPE html> 
<html> 
<head> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.js"></script>

    <script>
    $(document).ready(function()
    {
        $("#initialpopup").popup("open");

        setTimeout(function()
        {
            $("#initialpopup").popup("close");
        }, 500);    

    });
    </script>
</head>
<body>

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

        <div data-role="popup" id="initialpopup" data-overlay-theme="a" data-theme="a">Foobar</div>


    </div>

</body>
</html>

推荐答案

您可以尝试

$('#initialpopup').popup('open', {transition: 'pop'});
window.setTimeout('$("#initialpopup").popup("close");', 500);

这篇关于jQuery移动弹出窗口未关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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