I am trying to close a Fancybox automatically (using parent.$.fancybox.close(); ), but for some reason it is not working because the Fancybox was initiated from some dynamically loaded content using .load() with Jquery. Is there some kind of special code I need to tag along with the close function to let fancybox know it was initiated from an external source?
I am trying to close a Fancybox automatically (using parent.$.fancybox.close(); ), but for some
Share
If you’re using
loadto display content via AJAX, thenparentis not needed. This is because the AJAX content is added directly to the main page’s DOM tree. You should only useparentif you’re loading an iframe and want to close from within the iframe. If you want to cover both cases use:top.$.fancybox.close();(This will work as long as the main page isn’t displayed within a frame.)
If this doesn’t answer your question, please provide more details on where you’re trying to close the fancy box from — from a user-triggered link in the content? from within a script in the loaded content? from within a script in the main page?