Created
November 7, 2016 13:24
-
-
Save rosell-dk/e4f8c9802945b38d33dd0fcb601ce61d to your computer and use it in GitHub Desktop.
This mimics the official tweet button that Twitter provides (the large one). Prevents flash of unstyled content
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
HTML to insert button: | |
<div class="twitter-btn"> | |
<a href="https://twitter.com/intent/tweet?text=A%20down%20to%201k%20replacement%20of%20jQuery&url=http%3A%2F%2Fpicoquery.com"><i></i> | |
<span>Tweet</span></a> | |
</div> | |
If you want a dialog to open, like with the official twitter button, you can include the official javascript. | |
It works on this button too. | |
<script>window.twttr = (function(d, s, id) { | |
var js, fjs = d.getElementsByTagName(s)[0], | |
t = window.twttr || {}; | |
if (d.getElementById(id)) return t; | |
js = d.createElement(s); | |
js.id = id; | |
js.src = "https://platform.twitter.com/widgets.js"; | |
fjs.parentNode.insertBefore(js, fjs); | |
t._e = []; | |
t.ready = function(f) { | |
t._e.push(f); | |
}; | |
return t; | |
}(document, "script", "twitter-wjs"));</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment