Created
August 28, 2014 15:39
-
-
Save thedotmack/b092198d208e8257e563 to your computer and use it in GitHub Desktop.
Simple js / jquery tweet buttons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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