Created
November 27, 2012 11:23
-
-
Save plamere/4153748 to your computer and use it in GitHub Desktop.
dynamically adapting the tweet button
This file contains 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
<body> | |
The tweet button: | |
<span id='tweet-span'> | |
<a href="https://twitter.com/share" id='tweet' | |
class="twitter-share-button" | |
data-lang="en" | |
data-count='none'>Tweet</a> | |
<script>!function(d,s,id){varjs,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> | |
</span> | |
<script> | |
function tweetSetup() { | |
$(".twitter-share-button").remove(); | |
var tweet = $('<a>') | |
.attr('href', "https://twitter.com/share") | |
.attr('id', "tweet") | |
.attr('class', "twitter-share-button") | |
.attr('data-lang', "en") | |
.attr('data-count', "none") | |
.text('Tweet'); | |
$("#tweet-span").prepend(tweet); | |
tweet.attr('data-text', "#InfiniteJukebox of " + t.fixedTitle); | |
tweet.attr('data-url', document.URL); | |
twttr.widgets.load(); | |
} | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment