简体   繁体   English

Jquery 颜色框,提交表单后关闭颜色框

[英]Jquery colorbox, close colorbox after form submitted

Using colorbox:使用彩盒:

http://colorpowered.com/colorbox/

Im using this to open a window up using the iframe function in colorbox.我使用它在 colorbox 中使用 iframe function 打开 window 。 In the popup window/iframe I have a form.在弹出窗口/iframe 中,我有一个表单。 What Im trying to achieve is when the form is submitted I want the colorbox window to close and the parent window to refresh.我想要实现的是在提交表单时我希望颜色框 window 关闭并且父 window 刷新。 Can anyone help me with this?谁能帮我这个? Here is the code Im using now, when I manually close the colorbox window the parent page refreshes, but how do I tell the page inside the colorbox popup to close colorbox?这是我现在使用的代码,当我手动关闭颜色框 window 时,父页面会刷新,但是如何告诉颜色框弹出窗口内的页面关闭颜色框?

    jQuery(document).ready(function(){
        jQuery(".purchasepop").colorbox({width:"80%", height:"80%", iframe:true,
        onClosed:function(){ location.reload(true); }});
        });

Ok got it to work, was referencing the wrong "variable" as I am using noconflict to load jquery.好的,它可以工作,因为我使用 noconflict 加载 jquery 时引用了错误的“变量”。 This worked:这有效:

parent.jQuery.fn.colorbox.close();

I used the following code to close my the color box on my cancel button click event.我使用以下代码关闭了取消按钮单击事件的颜色框。

jQuery(document).ready(function () {
     jQuery("#<%= btnCancel.ClientID %>").click(function () {
        parent.jQuery.colorbox.close();
     });
});

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

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