I\'m using fancy box to create a popup and load another page on it using an iframe. here is my code
This is an old thread but I thought I'd share my two cents.
I was having similar issues with closing the fancybox iframe using the onclick event and after many tries, this did the trick for me: window.parent.jQuery.fancybox.close()
Here's an example using an input button:
<input type="button" class="formbutton" value="Close" onClick="window.parent.jQuery.fancybox.close();" />
As well, I tested the onlick on an anchor (a) tag and it worked fine.
call to $.fancybox.close();
also look on this answers in the post
According to http://fancybox.net/faq
- 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
.
$.fn.fancybox.close()
doesn't work for version 2.x, in fact, it raises an error. If you're using version 2.x, try $.fancybox.close(true)
instead.