Skip to content

Instantly share code, notes, and snippets.

@ajace
Created October 14, 2014 16:27
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 ajace/0ac1d6e7515d2b0c087d to your computer and use it in GitHub Desktop.
Save ajace/0ac1d6e7515d2b0c087d to your computer and use it in GitHub Desktop.
Twitter Tweet Popup
<script>
function tweetIt(event) {
window.twttr=window.twttr||{};
var D=550,A=450,C=screen.height,B=screen.width,H=Math.round((B/2)-(D/2)),G=0,F=document,E;
if(C>A){G=Math.round((C/2)-(A/2))}
var fullLink = 'http://twitter.com/share?url=' + encodeURIComponent(document.URL) + '&text=' + encodeURIComponent(document.title);
window.twttr.shareWin=window.open(fullLink,'','left='+H+',top='+G+',width='+D+',height='+A+',personalbar=0,toolbar=0,scrollbars=1,resizable=1');
E=F.createElement('script');
E.src='https://platform.twitter.com/widgets.js';
F.getElementsByTagName('head')[0].appendChild(E);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment