JSFiddle - React, Tailwind, and code Playground
by Idered
HTML
<script src="http://platform.twitter.com/widgets.js"></script>
<script src="http://fonts.googleapis.com/css?family=Open+Sans"></script>
<div class="twitter-follow">
<a href="//twitter.com/Idered" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @Idered</a>
<a href="//twitter.com/Idered" class="twitter-follow__button">Follow @Idered</a>
</div>
<p>Click, and <a href="http://twitter.com/Idered">check</a> my twitter profile, it works :)</p>
CSS
body {
font-family: "Open Sans", sans-serif;
}
.twitter-follow {
position: relative;
display: inline-block;
}
.twitter-follow iframe {
opacity: 0;
}
.twitter-follow__button {
color: #666;
text-decoration: none;
width: 100%;
top: 0;
left: 0;
position: absolute;
display: block;
text-align: center;
line-height: 28px;
background: #fff;
border: 1px solid #00a0d1;
border-radius: 5px;
font-family:"Open Sans";
font-size: .75em;
z-index: -1;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.twitter-follow__button.active, .twitter-follow iframe:hover + .twitter-follow__button {
display: inline-block;
background: #00a0d1;
color: #fff;
}
JavaScript
/* Created by Idered | http://idered.pl
* Comments here: https://news.ycombinator.com/item?id=5391457 */
var twitterButton = document.querySelector('.twitter-follow__button'),
detectFollow = setInterval(function () {
if (/twitter-follow-button/.test(document.activeElement.className)) {
twitterButton.innerText = 'Thanks!';
twitterButton.className = twitterButton.className + " active";
clearInterval(detectFollow);
}
}, 250);