Skip to content

Instantly share code, notes, and snippets.

@joecritch
Created October 5, 2012 17:11
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 joecritch/3841065 to your computer and use it in GitHub Desktop.
Save joecritch/3841065 to your computer and use it in GitHub Desktop.
Show hidden images temporarily if sharing to Pinterest (using AddThis)
// Don't forget to include AddThis.
// It's actually really good now so you should be using it.
$images = [ ]; // Or wherever your hidden images are.
// Show images temporarily if sharing to Pinterest
// (Because Pinterest won't see the backgrounds.)
if(typeof addthis !== 'undefined') {
addthis.addEventListener('addthis.menu.share', function(e) {
if (e.type == 'addthis.menu.share' && e.data.service === "pinterest_share") {
$images.show().addClass('visuallyhidden');
setTimeout(function() {
$images.hide().removeClass('visuallyhidden');
}, 2000); // Give pinterest time to load.
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment