Skip to content

Instantly share code, notes, and snippets.

@stenvdb
Created March 15, 2012 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stenvdb/2044958 to your computer and use it in GitHub Desktop.
Save stenvdb/2044958 to your computer and use it in GitHub Desktop.
JavaScript: Init AddThis Ajax
// Init addthis
if (addThisFirstLoad) {
var script = 'http://s7.addthis.com/js/250/addthis_widget.js#domready=1';
if (window.addthis){
window.addthis = null;
}
$.getScript( script, function(){ addthis.init(); } );
addThisFirstLoad = false;
} else {
// Update the buttons (and dont download the script twice)
//var title = "New title!";
addthis.ost = 0;
addthis.update('share', 'url', window.location.href);
//addthis.update('share', 'title', title);
addthis.ready();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment