Detect when Facebook Like Button loads

As you probably know, the Facebook Like button loads very slowly.

And I'm trying to figure out how to determine when the button finished loading and was added to the website.

The reason is because I show the loading animation and then hide it and show the button, but I want to show the button when it finishes loading.

Can this be done?

Thanks in advance to everyone!

+5
source share
3 answers

subscribe subscribe, , ( xfbml, html5 ). , SDK FB JS, xfbml : true.

window.fbAsyncInit = function() {
  FB.init({
    ...
    xfbml : true
  });

  FB.Event.subscribe('xfbml.render', function(response) {
      alert('OMG... All Facebook sociaal plugins on page rendereed.... finally!');
  });
};

// And load the SDK Asynchronously here
+21

, facebook iFrame. , -, iFrame โ†’

$('iframe[class/id/name=whatever]').load(function(){ 
  //This element is loaded 
});

, , , frameborder="0" .

$('iframe[frameborder=0]').load(function(){
  alert("loaded.");
}); 
+1

Facebook , , FB.XFBML.parse , , .

+1

All Articles