Last Updated: February 25, 2016
·
314
· kylehotchkiss

Open Facebook's sharer.php similarly twitter intents popup

Make your facebook sharer.php social links open the same way as Twitter's intent links.

var socialpopup = function( url, title, width, height ) {
    var top = ( screen.height / 2 ) - ( height / 2 );
    var left = ( screen.width / 2 ) - ( width / 2 );

    return 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^='https://www.facebook.com/sharer/sharer.php']").click(function( event ) {
    event.preventDefault();

    var url = jQuery(this).attr("href");

    socialpopup( url, "Share on Facebook", 550, 520 );
});