Is there something I can bind a jQuery event to when is Facebook embed post is finished loading?
I need to trigger a masonry reload after all my Facebook posts are loaded, because they only have the right height after the content is loaded.
The closest I got was:
$(window).on('load', function () {
$('iframe').on('load', function () {
$container.masonry();
});
});
But somehow the event is triggered sometimes before the content is loaded.
If you invoke the XFBML parser directly (so use xfbml=0
instead of the normally embedded xfbml=1
) you can include a callback:
window.fbAsyncInit = function() {
FB.XFBML.parse(null, function() {
console.log("parsing is complete!");
});
};
It occurred to me that there is another way, using the ready handler -
$(window).on('load', function () {
$('iframe').ready(function () {
$container.masonry();
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With