简体   繁体   English

如何在弹出页面事件中关闭jQuery SimpleModal外部页面弹出窗口?

[英]How to close jQuery SimpleModal external page popup on popup page event?

I have an asp.net c# project and need to open another page (within the project) as a popup using jQuery SimpleModel plugin, and close it when user clicks on a link on the popup page. 我有一个asp.net c#项目,需要使用jQuery SimpleModel插件打开另一个页面(在项目内)作为弹出窗口,并在用户单击弹出页面上的链接时将其关闭。 (This link also has some serverside code.) (此链接也有一些服务器端代码。)

I could open a page with this code, 我可以用此代码打开一个页面,

$('a#Test').click(function() {
            $.modal('<iframe src="PopUp.aspx" height="450" width="830" style="border:0">', {
                closeHTML: "",
                containerCss: {
                    backgroundColor: "#fff",
                    borderColor: "#fff",
                    height: 450,
                    padding: 0,
                    width: 830
                },
                overlayClose: true
            });
        });

but can't figure it out how to close it on click event of popup page. 但无法弄清楚如何在弹出页面的点击事件中将其关闭。

Thanks 谢谢

From PopUp.aspx, you'd want to use: 从PopUp.aspx,您需要使用:

parent.$.modal.close(); // or parent.jQuery.modal.close();

In the same page, you'd use: 在同一页面中,您将使用:

$.modal.close(); // or jQuery.modal.close();

It's work fine for me: 对我来说很好

('a#Test').click(function() {
    $.modal('<iframe src="PopUp.aspx" height="450" width="830" style="border:0"/><p><center><input value="Close" name="Close" class="CloseBtn" type="button" /></center></p>', {
        closeHTML: "",
        containerCss: {
            backgroundColor: "#fff",
            borderColor: "#fff",
            height: 450,
            padding: 0,
            width: 830
        },
        closeClass:('CloseBtn')
    });
});

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

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