简体   繁体   中英

How to Reopen parent fancybox by closing child fancy Box?

I am using the fancybox from the link: fancyapps

In my page i have two editions :

first edit link is as follows :

<a id="edit_campaign" title="Edit Campaign" class="edit_icon fancybox1 fancybox.ajax" href="edit_campaign_box.php?campId=<?php echo campid ?>"></a>

when i click the above link , fancy box will be opened using the js

$(".fancybox1").fancybox({
        maxWidth    : 650,
        minHeight   : 400,
        height      : 'auto',
        fitToView   : true,
        autoSize    : false,
        closeClick  : false,
        openEffect  : 'none',
        closeEffect : 'none',
        helpers     : {
          overlay : {           
             css      : {
                 cursor : 'default'
             },
             closeClick: false
        }
        }
    });

and after opening the fancybox , i need to open another fancybox during clicking the following link :

<a title="Edit" class="edit_icon fancybox2 fancybox.ajax " href="edit_campaign_phrase_box.php?keyword=<?php echo urlencode($camp->keyword);?>&searchKeyId=<?php echo $camp->searchKeywordId;?>&campaignId=<?php echo $campaignId;?>"></a>

2nd fancybox will be opened using

$(".fancybox2").click(function(){

        $(".fancybox2").fancybox({
            maxWidth    : 300,
            maxHeight   : 80,
            fitToView   : false,
            height      : 'auto',
            autoSize    : false,
            closeClick  : false,
            openEffect  : 'none',
            closeEffect : 'none',
            afterClose    : function(){                               
                               $.fancybox.open([{href : 'edit_campaign_box.php?campId=264',title : 'Edit Campaign'}]);
                            },
            helpers     : {
                  overlay : {           
                     css      : {
                         cursor : 'default'
                     },
                     closeClick: false
                }
            }           
        });
    });

After opening 2nd fancybox , I will update the form and close the fancybox2.

After closing the fancybox2 , i need to reopen fancybox1 , i tried by adding callback to the 2nd fancybox but the callback function is called number of times but fancybox 2 is not opening .. please help me.. Thanks in advance ..

Now I have got output , by changing the old version of fancybox to new and replacing the single code of fancybox 2:

afterClose    : function(){                               
                      $("#edit_campaign").trigger("click");           
                 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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