air
air

Reputation: 6264

closing fancy box from its own iframe page

i have opened fancy box with following code

       $("#tip5").fancybox({
            'width': 400,
            'height': 370,
            'enableEscapeButton' : false,
            'overlayShow' : true,
            'overlayOpacity' : 0,
            'hideOnOverlayClick' : false,
            'type': 'iframe',
            'href': "abc.php?id=20"
        });

abc.php is opening in fancy box and working fine.

but i want to close this fancybox from abc.php after specific time and i have written following code in abc.php

$(document).ready(function(e){                            
 setTimeout(function() {
                $.fancybox.close();
                }, 3000);
    });

i also tried

$.fn.fancybox.close() 

its not closing but i am getting following error

$.fancybox is undefined

Upvotes: 0

Views: 1043

Answers (1)

Frenk
Frenk

Reputation: 91

This should do the trick:

parent.jQuery.fancybox.close();

See this page and click the link 'Iframe (75% width and height)'

Upvotes: 1

Related Questions