Search code examples
jquery-pluginsfacebook-social-plugins

How to load a function method after facebook social plugin is has finished loaded?


I have jQuery masonry to layout the list items on my website, each list item has a fb:comments. Loading SDK asynchronously, even putting the method "$container.masonry( 'reload' );" after FB.init() the list items are still overlapping.

I tested putting an alert() box before reload masonry, if close the alert box quickly the items are still overlapping but if close it after a while it display correctly with margin. So I assume the masonry reload runs before the content of fb:comments finish loaded.

How do I trigger masonry reload after the content of fb:comments finish loaded? Not by button click. Images show when it's overlapping and masonry reload after fb:comments.


Solution

  • If you use xfbml version of plugins, you can subscribe to xfbml.render - fired when all plugin (calls) completes. http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/