JSFiddle - React, Tailwind, and code Playground
HTML
Working:
<li><div class="main-overlay"></div><span class="caption">The store front</span><img src="http://dougie.thewestharbour.com/wp-content/uploads/store-front.jpg" alt="store front" title="store-front" width="365" height="180" class="alignnone size-full wp-image-98" /></li>
Broken:
<li><div class="main-overlay2"></div><span class="caption">The store front</span><img src="http://dougie.thewestharbour.com/wp-content/uploads/store-front.jpg" alt="store front" title="store-front" width="365" height="180" class="alignnone size-full wp-image-98" /></li>
CSS
li {
position:relative;
}
.main-overlay, .main-overlay2 {
background:rgba(0,0,0,0.5);
width:100%; height:100%;
position:absolute; top:0; left:0;
}
JavaScript
$('.main-overlay').hover(function() {
$(this).animate({opacity: 0}, 300);
}, function() {
$(this).animate({opacity: 1}, 300);
});
$('.main-overlay2').hover(function() {
$(this).fadeOut(300);
}, function() {
$(this).fadeIn(300);
});