Last active
December 16, 2015 13:29
-
-
Save guillaumepiot/5442391 to your computer and use it in GitHub Desktop.
SOCIAL - Facebook share
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
// In you page header, add the open graph meta tags | |
// <meta property="og:title" content="title" /> | |
// <meta property="og:description" content="description" /> | |
// <meta property="og:image" content="thumbnail_image" /> | |
// We bind a new event to our link | |
$('a.facebook').click(function(e){ | |
//We tell our browser not to follow that link | |
e.preventDefault(); | |
//We get the URL of the link | |
var loc = $(this).attr('href'); | |
//We trigger a new window with the Twitter dialog, in the middle of the page | |
window.open('https://www.facebook.com/sharer/sharer.php?u=' + loc +'&', 'facebookwindow', 'height=450, width=550, top='+($(window).height()/2 - 225) +', left='+$(window).width()/2 +', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment