Created
April 25, 2012 14:51
-
-
Save battlejj/2490314 to your computer and use it in GitHub Desktop.
Tweet button doesn't work
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
| .custom-tweet-button a { | |
| display: block; | |
| padding: 2px 5px 2px 60px; | |
| color:#2A7090; | |
| background: url("http://platform0.twitter.com/widgets/images/tweet.png") no-repeat scroll 0 0 transparent; | |
| } | |
| .twitterDiv { | |
| float:left; | |
| border:none; | |
| font-weight:bold; | |
| } |
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
| //you'll need jQuery ;) | |
| $('.twitterDiv').each(function(){ | |
| effTwitter($(this)); | |
| }); | |
| function effTwitter($obj){ | |
| var count = 0; | |
| $.ajax({ | |
| url: 'http://urls.api.twitter.com/1/urls/count.json?twitterCacheSux=1&url=' + encodeURIComponent($obj.attr("rel")), | |
| dataType: "jsonp", | |
| success: function(response){ | |
| console.log(response); | |
| console.log(response.count); | |
| count = parseInt(response.count); | |
| $obj.find(".custom-tweet-button a").html(count); | |
| } | |
| }) | |
| } |
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
| <div class="twitterDiv" rel="http://yoururlhere.com/whatever/article"> | |
| <div class="custom-tweet-button"> | |
| <a href="http://twitter.com/share?url=#urlencodedformat('http://yoururlhere.com/whatever/article')#" target="_blank"></a> | |
| </div> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment