I'm trying to change an img src when a mouse enters its parent div.
<div class="category-module-grid clearfix category-module row-feature-full row-feature-nopadding-top hp-dep five-columns">
<div class="category-module-item border-right">
<div class="category-module-item-inner">
<div class="article-img">
<div class="img-intro">
<img src="/images/home/ContactLenses.png" alt="">
</div>
</div>
<div class="article-content">
<h4><a class="mod-articles-category-title " href="/stomach">Contact Lenses</a></h4>
<p class="mod-articles-category-introtext">Nullam luctus vel tortor sit amet accumsan. Integer sit amet.</p>
</div>
</div>
I am able to change the img when it is hovered with the code below but when it comes to what i really want i'm stuck...
$(function($) {
$(".hp-dep .category-module-item img").mouseover(function() {
var src = $(this).attr('src', $(this).attr('src').replace(/(.png)$/, '') + '-wh.png')
})
.mouseout(function() { var src = $(this).attr("src").replace("-wh", "");
$(this).attr("src", src);
});
});
Any help is appreciated http://jsfiddle.net/v5d9p08t/4/
edit * I have 2 rows of 5 of these *