Skip to content

Instantly share code, notes, and snippets.

@kylehotchkiss
Created December 7, 2015 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylehotchkiss/e05eccde268327c6087f to your computer and use it in GitHub Desktop.
Save kylehotchkiss/e05eccde268327c6087f to your computer and use it in GitHub Desktop.
ar social = function() {
jQuery("a[href*='twitter.com/intent']").unbind();
var socialpopup = function( url, title, width, height ) {
var top = ( screen.height / 2 ) - ( height / 2 );
var left = ( screen.width / 2 ) - ( width / 2 );
window.open( url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + width + ', height=' + height + ', top=' + top + ', left=' + left );
};
jQuery("a[href*='facebook.com/sharer']").click(function( event ) {
event.preventDefault();
var url = jQuery(this).attr("href");
socialpopup( url, "Share on Facebook", 550, 520 );
});
jQuery("a[href*='twitter.com/intent']").click(function( event ) {
event.preventDefault();
var url = jQuery(this).attr("href");
socialpopup( url, "Share on Twitter", 550, 520 );
});
};
jQuery(function() {
social();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment