简体   繁体   English

jQuery UI对话框,仅打开一次

[英]Jquery UI dialog, only opens once

I realize this has been asked before, but I am unable to get this to work even after reading other answers. 我知道以前曾有人问过这个问题,但即使阅读了其他答案也无法使它生效。

I'm using Jquery UI basic dialog popup to open a pop-up for a set of images. 我正在使用Jquery UI基本对话框弹出窗口打开一组图像的弹出窗口。

However, I am only able to open an image once, then the dialog will not open again. 但是,我只能打开一次图像,然后对话框将不会再次打开。 Here is my code: 这是我的代码:

 <script type="text/javascript"> // added .dialog:disaplay:none; to desktop.css
        $(".open").click(function(BasicDialog) {
            var div = $(this).next("div.dialog");
            var dia = $(div).dialog({
                draggable: false,

                width: "300px",
                modal: true,
                title: "",
                buttons: {
                    "Close": function () {
                        $(this).dialog("close");

                    }
                }

            });
            BasicDialog.preventDefault();
        });
</script>

Can anybody give me a hint towards what I am doing wrong here? 有人可以给我提示我在这里做错了什么吗?

Thanks, Mark 谢谢马克

autoOpen property. autoOpen属性。 It is what you are looking for. 这就是您想要的。 See the documentation: http://api.jqueryui.com/1.9/dialog/#option-autoOpen 请参阅文档: http : //api.jqueryui.com/1.9/dialog/#option-autoOpen

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM