Skip to content

Instantly share code, notes, and snippets.

@stowball
Created September 26, 2013 01:15
Show Gist options
  • Select an option

  • Save stowball/6708527 to your computer and use it in GitHub Desktop.

Select an option

Save stowball/6708527 to your computer and use it in GitHub Desktop.
Improved "perceived" performance of AddThis
.addthis_toolbox, .addthis_toolbox iframe {
visibility: hidden !important;
}
.addthis-loaded .addthis_toolbox, .addthis-loaded .addthis_toolbox iframe {
visibility: visible !important;
}
// Run after addthis include, on domready or similar
if (addthis) {
var addthisLoaded = function() {
window.setTimeout(function() {
document.documentElement.className += ' addthis-loaded';
}, 2000); // Magic number
};
if (addthis.addEventListener)
addthis.addEventListener('addthis.ready', addthisLoaded);
else if (addthis.attachEvent)
addthis.attachEvent('onaddthis.ready', addthisLoaded);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment