JSFiddle - React, Tailwind, and code Playground
HTML
<div id="div1"></div>
CSS
#div1 {
width:30px;
height:30px;
background-color:green;
cursor:pointer;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#div1:hover {
background-color:red;
}
.pushObject {
transform: translate(250px, 0px);
-webkit-transform: translate(250px, 0px);
-ms-transform: translate(250px, 0px);
-o-transform: translate(250px, 0px);
-moz-transform: translate(250px, 0px);
}
JavaScript
$('#div1').on('click', function () {
$(this).toggleClass('pushObject');
});