This little snippet is being posted because of extreme frustration in trying to find the answer for how to close a fancybox window with a link or button.  Hopefully this little tid-bit will help you out.

How to close Fancybox from an Iframe:

 

<button onclick=”parent.jQuery.fancybox.close();”>Close</button>


And it will look like this:



or for a textual link:

<a href=”#” onclick=”parent.jQuery.fancybox.close();”>Close</a>
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.