Skip to content

Instantly share code, notes, and snippets.

@thedotmack
Created August 28, 2014 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thedotmack/b092198d208e8257e563 to your computer and use it in GitHub Desktop.
Save thedotmack/b092198d208e8257e563 to your computer and use it in GitHub Desktop.
Simple js / jquery tweet buttons
<script src="//platform.twitter.com/widgets.js"></script>
<script>
var tweet = {
url: "", // url to share
via: "", // omit @, twitter username
text: "", // tweet text
hashtags: "" // omit #, comma seperated "twitter,twitterapi"
}
var intent_url = 'https://twitter.com/intent/tweet?' + $.param(tweet);
$('a#tweet-button').attr('href', intent_url);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment