Skip to content

Instantly share code, notes, and snippets.

@pcalves
Last active December 31, 2015 07:59
Show Gist options
  • Save pcalves/7957229 to your computer and use it in GitHub Desktop.
Save pcalves/7957229 to your computer and use it in GitHub Desktop.
Sharing without loading external elements.
<button href="http://twitter.com/home?status=STATUS" class="twitter">Tweet</button>
<button href="http://www.facebook.com/sharer.php?s=100&amp;p[url]=URL&amp;p[title]=TITLE&amp;p[summary]=DESCRIPTION&amp;p[images][0]=ABSOLUTE_LINK_TO_IMAGE" class="facebook">FB Share</button>
<button href="http://pinterest.com/pin/create/button/?url=URL&amp;media=MEDIA_IMG_OR_VIDEO&amp;description=DESCRIPTION" class="pinit">Pin It</button>
<button href="http://www.tumblr.com/share/link?url=URL&amp;name=NAME&amp;description=DESCRIPTION" class="tumblr">Tumblr</button>
$('.twitter, .facebook, .pinit, .tumblr').bind('click', function() {
var social = $(this).attr("class").replace(/[.]/, "");
window.open(
$(this).attr('href'),
$(this).attr('class'),
'height=260,width=600,resizable=1,left='+((screen.width/2)-300)+',top='+((screen.height/2)-130)
);
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment