Search code examples
javascriptjqueryfancybox

close fancy box from function from within open 'fancybox'


Hi all i want to be able to close fancyBox when it is open from within.

I have tried the following but to no avail:

function closeFancyBox(html){
    var re = /.*Element insert complete!.*/gi;
    if( html.search( re ) == 0 ){
        $.fancybox.close();
        //alert("foo");
    }
}

foo will open in dialog but will not close down. any hints?


Solution

  • Try this: parent.$.fancybox.close();

    See Fancybox API documentation.