Skip to content

Instantly share code, notes, and snippets.

@5iDS
Created July 22, 2013 18:30
Show Gist options
  • Save 5iDS/6056307 to your computer and use it in GitHub Desktop.
Save 5iDS/6056307 to your computer and use it in GitHub Desktop.
Loading Social Scripts Async.
(function social_async (d) {
var js,
ref = d.getElementsByTagName("head")[0];
js = d.createElement("script");
js.defer = true;
js.async = true;
js.type = "text/javascript";
var social_async_one = {
twitter: function(){
js.id = 'twitter';
js.src = 'http://platform.twitter.com/widgets.js';
ref.appendChild( js );
},
google_plus: function(){
js.id = 'google_plus';
js.src = 'http://apis.google.com/js/plusone.js';
ref.appendChild( js );
},
linkedin: function(){
js.id = 'linkedin';
js.src = 'http://platform.linkedin.com/in.js';
ref.appendChild( js );
}
};
social_async_one.twitter();
social_async_one.linkedin();
}(document));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment