Close ColorBox iFrame after submit

后端 未结 8 1454
刺人心
刺人心 2020-12-13 21:01

I\'m using jQuery ColorBox to display a shopping cart item. When a user enters the quantity in the iFrame (opened with colorbox) and clicks on the submit button, I want the

相关标签:
8条回答
  • 2020-12-13 21:25
    <form target="_top">
    
    0 讨论(0)
  • 2020-12-13 21:27

    use this on the parent window while opening iframe:

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

    and this to close the iframe inside iframe page:

    parent.$.fn.colorbox.close();
    
    0 讨论(0)
  • 2020-12-13 21:27

    After the form is submitted in Frame 1, you can use the following JavaScript to reload the parent frame:

    window.parent.location.reload(true);
    
    0 讨论(0)
  • 2020-12-13 21:29

    If you're using Drupal 7, you may need to use the following alternative:

    parent.jQuery.colorbox.close();
    

    In D7, the $.fn seems to be replaced by the jQuery object.

    I simply setup a menu callback which simply returned this:

    return <<<EOF
    <script type="text/javascript">
      <!--//--><![CDATA[//><!--
      parent.jQuery.colorbox.close();
      //--><!]]>
    </script>
    EOF;
    

    Seemed to work fine for me :)

    0 讨论(0)
  • 2020-12-13 21:30

    Give form tag like this:

    <form target="_top">
    

    then after submit:

    response.redirect("your form")
    
    0 讨论(0)
  • 2020-12-13 21:37

    If you want to stay on current page :

    1. write the following code on parent page where colorbox is applied.

      $(document).ready(function(){
      
       $(".tu_iframe_800x600").colorbox({width:"80%", height:"100%", iframe:false 
      
        });
      });
      
    2. and the following code on your current page where you want to close colorbox parent.$.fn.colorbox.close();

    Note: please replace .tu_iframe_800x600 with your html class on which the colorbox is called...

    0 讨论(0)
提交回复
热议问题