JSFiddle - React, Tailwind, and code Playground
HTML
<div style="margin-top:100px;">
<div class="corners">
<div id="1" class="noselect answerDiv gradient">
1
</div>
</div>
<div class="corners">
<div id="2" class="noselect answerDiv gradient">
1
</div>
</div>
</div>
CSS
.corners {
border: 1px solid rgb(0,0,0);
width:100px;
height:100px;
float:left;
display:inline-block;
position:relative;
top:0;
overflow: hidden;
}
.answerDiv {
position:relative;
overflow: hidden;
width:100px;
height:100px;
line-height: 100px;
margin: 0px 1px 0px 1px;
text-align: center;
vertical-align: middle;
font-size: 100%;
font-style:normal;
font-family:Times New Roman;
color: rgb(0,0,0);
}
.noselect{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
outline: 0;
}
.gradient{
background: -moz-linear-gradient( top, rgba(166,166,255,0.9) 0%, rgba(0,0,255,0.9) 100%);
background: -webkit-gradient( linear, top, bottom, color-stop(0%,rgba(166,166,255,0.9)), color-stop(100%,rgba(0,0,255,0.9)));
background: -webkit-linear-gradient( top, rgba(166,166,255,0.9) 0%,rgba(0,0,255,0.9) 100%);
background: -o-linear-gradient( top, rgba(166,166,255,0.9) 0%,rgba(0,0,255,0.9) 100%);
background: -ms-linear-gradient( top, rgba(166,166,255,0.9) 0%,rgba(0,0,255,0.9) 100%);
background: linear-gradient( top, rgba(166,166,255,0.9) 0%,rgba(0,0,255,0.9) 100%);
zoom:1;
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#DDA6A6FF, endColorstr=#DD0000FF,GradientType=0 );
}
JavaScript
function clickEvent(){
$('.answerDiv').click(function(){
$( "div:animated" ).stop();
if ( idPreviousClick === $(this)[0].id) {
} else {
if (idPreviousClick != -1) {
$("#"+idPreviousClick).css({height:'100px', width:'100px', top:'0', 'line-height': '100px'});
$("#"+idPreviousClick).parent().css({height:'100px', width:'100px', top:'0'});
}
$(this).animate({height:'120px', width:'120px', 'line-height': '120px'});
$(this).parent().animate({height:'120px', width:'120px', top:'-10px'});
idPreviousClick = $(this)[0].id;
}
});
}
$(document).ready(function(){
clickEvent();
});
var idPreviousClick = -1;