I have to run fancybox with trigger click in my website, the problem that i discovered is that with this method if you click on elements in
I don't know it will be helpful or not just try this,
$(document).ready(function(e) { e.preventDefault(); $('#a1').fancybox({ afterClose: function() { console.log('closed :( '); } }).click();// or .trigger('click'); });