Skip to content

Instantly share code, notes, and snippets.

@mosinski
Created July 6, 2014 23:46
Show Gist options
  • Save mosinski/d60f12a66e2b3782aed5 to your computer and use it in GitHub Desktop.
Save mosinski/d60f12a66e2b3782aed5 to your computer and use it in GitHub Desktop.
custom fb share button
<a href="javascript:fbShare('http://gdanskcurlingclub.pl/news/21', 'Fb Share', 'Facebook share popup')">Share</a>
<script>
function fbShare(url, title, descr, image, winWidth, winHeight) {
var winTop = (screen.height / 2) - (winHeight / 2);
var winLeft = (screen.width / 2) - (winWidth / 2);
window.open('http://www.facebook.com/sharer.php?s=100&p[title]=' + title + '&p[summary]=' + descr + '&p[url]=' + url + '&p[images][0]=' + image, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment