Skip to content

Instantly share code, notes, and snippets.

@elzii
Last active January 3, 2016 15:09
Show Gist options
  • Save elzii/8480658 to your computer and use it in GitHub Desktop.
Save elzii/8480658 to your computer and use it in GitHub Desktop.
addthis ajax fix
/*
Addthis JS Fix
--------------
Assumes content lives in partial/content that is being loaded by an AJAX call
*/
// set addthos_config obj
var addthis_config = addthis_config||{};
// set the pubid to config obj
addthis_config.pubid = '__YOUR_PUBID__';
// clear properties in addthis obj
if (window.addthis) {
window.addthis = null;
window._adr = null;
window._atc = null;
window._atd = null;
window._ate = null;
window._atr = null;
window._atw = null
}
// use jQ to get script externally
jQuery.getScript( "https://s7.addthis.com/js/300/addthis_widget.js")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment