JSFiddle - React, Tailwind, and code Playground
by bitstarr
HTML
<div class="item"></div>
CSS
.item {
background: url(http://sebastianlaube.de/gfx/logo.png) no-repeat 50%;
height: 120px;
width: 120px;
border: 3px solid #fff;
border-radius: 50%;
box-shadow: 0 0 1px 0 rgba(0,0,0,.5);
}
.small {
animation-duration: 2s;
animation-name: scale;
transform: scale(.5);
}
@keyframes scale {
0% {
transform: scale(1);
}
50% {
transform: scale(0);
}
100% {
transform: scale(.5);
}
}
JavaScript
$('div.item').on({
'mouseenter': function(){
$(this).addClass('small');
},
'click': function() {
$(this).toggleClass('small');
}
});