JSFiddle - React, Tailwind, and code Playground
HTML
<div style="width:100px;">
<!-- height : 100% -->
<img src="http://placehold.it/200x200" style="width:100%;height:100%;"/>
</div>
<div style="width:100px;">
<img src="http://placehold.it/200x200" style="width:100%;"/>
</div>
<button>refresh</button>
JavaScript
var path1 = "http://placehold.it/200x200";
var path2 = "http://placehold.it/200x400";
$('img').bind('click',function(){
if( $(this).attr('src') == path1 )
$(this).attr('src',path2);
else
$(this).attr('src',path1);
});
$('button').bind('click',function(){
$('div').hide();
setTimeout(function(){ $('div').show(); },50);
});