Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 891
Phil Jackson Avatar asked Dec 01 '09 22:12

Phil Jackson


2 Answers

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

See Fancybox API documentation.

like image 59
Matt Furlong Avatar answered Oct 01 '22 04:10

Matt Furlong


According to http://fancybox.net/faq

  1. How can I close FancyBox from other element? ?

Just call $.fn.fancybox.close() on your onClick event

So you should just be able to add in the fn.

like image 35
Justin Johnson Avatar answered Oct 01 '22 05:10

Justin Johnson