Skip to content

Instantly share code, notes, and snippets.

@adamcbrewer
Last active October 8, 2015 23:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamcbrewer/3403901 to your computer and use it in GitHub Desktop.
Save adamcbrewer/3403901 to your computer and use it in GitHub Desktop.
Social: Custom sharing links
<a id="fb-share-popup" href="http://www.facebook.com/sharer.php?s=100&amp;p[title]=____&amp;p[url]=____&amp;p[summary]=____&amp;p[images][0]=____" target="_blank">share on Facebook</a>
<script>
// This will open our link in a new, small window in the middle of the browser
var p = {};
p.w = 700;
p.h = 400;
p.l = (screen.width/2)-(p.w/2);
p.t = (screen.height/2)-(p.h/2);
$('#fb-share-popup').on('click', function (evt) {
evt.preventDefault();
newwindow = window.open(this.href, this.title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width='+p.w+', height='+p.h+', top='+ p.t +', left='+p.l);
if (window.focus) newwindow.focus();
});
</script>
<a id="gp-share-popup" href="https://plus.google.com/share?url=____" target="_blank">Share on Google Plus</a>
<script>
// This will open our link in a new, small window in the middle of the browser
var p = {};
p.w = 700;
p.h = 400;
p.l = (screen.width/2)-(p.w/2);
p.t = (screen.height/2)-(p.h/2);
$('#gp-share-popup').on('click', function (evt) {
evt.preventDefault();
newwindow = window.open(this.href, this.title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width='+p.w+', height='+p.h+', top='+ p.t +', left='+p.l);
if (window.focus) newwindow.focus();
});
</script>
<a id="tw-share-popup" href="http://twitter.com/intent/tweet?url=____&text=____&hashtags=____,____,____" target="_blank">Share on Twitter</a>
<script>
// This will open our link in a new, small window in the middle of the browser
var p = {};
p.w = 700;
p.h = 400;
p.l = (screen.width/2)-(p.w/2);
p.t = (screen.height/2)-(p.h/2);
$('#tw-share-popup').on('click', function (evt) {
evt.preventDefault();
newwindow = window.open(this.href, this.title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width='+p.w+', height='+p.h+', top='+ p.t +', left='+p.l);
if (window.focus) newwindow.focus();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment