Created
October 5, 2012 17:11
-
-
Save joecritch/3841065 to your computer and use it in GitHub Desktop.
Show hidden images temporarily if sharing to Pinterest (using AddThis)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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