I run into this issue from time to time and I don't know how to solve it. Here's my code that fails:
function on_lightbox_open() {
system.contextBrowserInit();
updateUrl(year + '/' + month + '/' + id);
ads.reload();
system.analytics.reload();
FB.XFBML.parse($('#bottom_flap .fb_like').get(0)); // facebook
$.ajax({ url: 'http://platform.twitter.com/widgets.js', dataType: 'script', cache: true });
$('#lightbox .close').live('click', function(){
$.modal.close();
});
}
If I add an alert at the begining like so:
function on_lightbox_open() {
alert('i work now');
system.contextBrowserInit();
updateUrl(year + '/' + month + '/' + id);
ads.reload();
system.analytics.reload();
FB.XFBML.parse($('#bottom_flap .fb_like').get(0)); // facebook
$.ajax({ url: 'http://platform.twitter.com/widgets.js', dataType: 'script', cache: true });
$('#lightbox .close').live('click', function(){
$.modal.close();
});
}
It magically works. How to make it work without an annoying random alert?