JSFiddle - React, Tailwind, and code Playground
HTML
<img onclick="image(this)" class="contentimgleft" src="http://lorempixel.com/50/50/abstract/1"/>
<img onclick="image(this)" class="contentimgleft" src="http://lorempixel.com/50/50/abstract/2"/>
CSS
.contentimgleft {
float: left;
margin: 5px 5px 5px 10px;
background-color: #888888;
width: 25%;
height: 25%;
-webkit-transition: all .4s linear;
-moz-transition: all .4s linear;
-o-transition: all .4s linear;
-ms-transition: all .4s linear;
transition: all .4s linear;
}
.contentimgleftl {
float: left;
margin: 5px 5px 5px 10px;
background-color: #888888;
width: 97%;
height: 98%;
-webkit-transition: all .4s linear;
-moz-transition: all .4s linear;
-o-transition: all .4s linear;
-ms-transition: all .4s linear;
transition: all .4s linear;
}
JavaScript
function image(img) {
if (img.className.match(/(?:^|\s)contentimgleft(?!\S)/)) {
img.className = "contentimgleftl";
} else {
img.className = "contentimgleft";
}
}