JSFiddle - React, Tailwind, and code Playground
by iamvdo
HTML
<h2>Demo transition simple</h2>
<div id="vdo-1">Survolez-moi! <small>(ou cliquez)</small></div>
CSS
body{
padding: 70px;
font: 1em sans-serif;
}
h2{
font-size: 1.6em;
}
#vdo-1{
width: 300px;
height: 100px;
line-height: 100px;
padding: 0 0 0 30px;
background: crimson;
-webkit-transition: width 1s linear, background-color 1s linear;
-moz-transition: width 1s linear, background-color 1s linear;
-o-transition: width 1s linear, background-color 1s linear;
transition: width 1s linear, background-color 1s linear;
}
#vdo-1.anim,
#vdo-1:hover{
background: orangered;
width: 450px;
}
JavaScript
$(function(){
$('[id^=vdo]').click(function(e){
$(this).toggleClass('anim');
});
});