I am having an issue closing Fancybox using a custom close button on content that is pulled in via Infinite Scroll.
http://fancyapps.com/fancybox/
http://www.infinite-scroll.com/
Everything that is included on the page before Infinite Scroll can open and close just fine. For content that is pulled in via Infinite Scroll, I can launch the Fancybox without issue, but upon clicking close, I simply get thrown backup to the top of the page and the Fancybox never closes.
Here is the code I’m using:
HTML
<a href="#" class="fncy-custom-close">
<span>Close</span>
</a>
JS
$(document).ready(function() {
$('.fancybox').fancybox({
padding : 0,
scrolling : 'no',
arrows : false,
closeBtn : false,
helpers : {
overlay: {
opacity: 0.6
}
}
});
$('a.fncy-custom-close').click(function(e){
e.preventDefault();
$.fancybox.close();
});
});
Any help is greatly appreciated. Thanks.
This may have been a bug in the plugin, as it seems to have resolved itself. All is good now!