JSFiddle - React, Tailwind, and code Playground
by James Gill
HTML
<!--/*/
Comment speech bubble to circle animation
/*/-->
<div class="comment_button">
<button class="comment_button_inner no-count">
<span class="count">0</span>
<span class="closer">×</span>
</button>
</div>
<br />
<br />
<br />
<div class="comment_button">
<button class="comment_button_inner">
<span class="count">6</span>
<span class="closer">×</span>
</button>
</div>
<br />
<br />
<br />
<div class="comment_button">
<button class="comment_button_inner">
<span class="count">68</span>
<span class="closer">×</span>
</button>
</div>
<br />
<br />
<br />
<div class="comment_button">
<button class="comment_button_inner">
<span class="count">188</span>
<span class="closer">×</span>
</button>
</div>
CSS
/* square circle */
body {
font-family:helvetica;
font-size: 12px;
background: #f0f0f0;
padding-top: 50px;
padding-left:50px;
}
button:active,
button:focus{
outline:0;
}
br{
clear:both;
}
.comment_button {
width: auto;
display: inline-block;
position: relative;
height: 22px;
line-height:22px;
float:left;
opacity:0.8;
-webkit-transition: all 0.15s ease-in-out;
-moz-transition: all 0.15s ease-in-out;
-ms-transition: all 0.15s ease-in-out;
-o-transition: all 0.15s ease-in-out;
transition: all 0.15s ease-in-out;
}
.comment_button .comment_button_inner {
display: block;
color:#FFF;
font-size:12px;
padding: 0 6px;
width: 100%;
height: 100%;
border:none;
min-width:22px;
border-radius:0;
margin:0;
background:#6f6f6e;
position:relative;
cursor:pointer;
-webkit-transition: all 0.15s ease-in-out;
-moz-transition: all 0.15s ease-in-out;
-ms-transition: all 0.15s ease-in-out;
-o-transition: all 0.15s ease-in-out;
transition: all 0.15s ease-in-out;
}
.comment_button .comment_button_inner:after {
left: 0%;
border: solid transparent;
content:" ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(255, 255, 255, 0);
border-left-color: #6f6f6e;
border-top-color: #6f6f6e;
border-width: 2px;
top: 100%;
-webkit-transition: all 0.15s ease-in-out;
-moz-transition: all 0.15s ease-in-out;
-ms-transition: all 0.15s ease-in-out;
-o-transition: all 0.15s ease-in-out;
transition: all 0.15s ease-in-out;
}
.comment_button .comment_button_inner .count,
.comment_button .comment_button_inner .closer{
-webkit-transition: all 0.15s ease-in-out;
-moz-transition: all 0.15s ease-in-out;
-ms-transition: all 0.15s ease-in-out;
-o-transition: all 0.15s ease-in-out;
transition: all 0.15s ease-in-out;
}
.comment_button...
JavaScript
$(function () {
$('.comment_button').click(function(){
$('.comment_button').not($(this)).removeClass('active');
$(this).toggleClass('active');
});
});