Skip to content

Instantly share code, notes, and snippets.

@arielcr
Last active December 19, 2015 20:19
Show Gist options
  • Save arielcr/6012281 to your computer and use it in GitHub Desktop.
Save arielcr/6012281 to your computer and use it in GitHub Desktop.
Sharing Links
/*
* Share on Facebook
*/
$('#facebook-Link').click(function () {
var sharer = "https://www.facebook.com/sharer/sharer.php?u=";
window.open(sharer + location.href, 'sharer', 'width=626,height=436');
});
/*
* Share on Twitter
*/
$('#twitter-Link').click(function (event) {
var width = 575,
height = 400,
left = ($(window).width() - width) / 2,
top = ($(window).height() - height) / 2,
url = this.href,
opts = 'status=1' +
',width=' + width +
',height=' + height +
',top=' + top +
',left=' + left;
window.open(url, 'twitter', opts);
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment