I’m writing a simple script that replaces two images. The first one swaps in fine, but the second one for some reason will not fire. It’s got to be something simple that I’m missing. Maybe the ‘div.singleTint img’ selector? Can someone take a look and double check my work?
Here’s my HTML:
<div id="beerGlassOverlay">
<img src="<?php bloginfo('template_directory'); ?>/images/beerOverlay.png" class="glassreplace">
</div>
<li class="image-rollover">
<a href="http://brasco.co/Mims/meet-the-breweries/miller-beers/" target="_blank">
<img width="177" height="186" src="http://brasco.co/Mims/wp-content/uploads/2012/05/miller1.png" class="attachment-full wp-post-image" alt="miller" title="miller" />
</a>
<div class="singleTint">
<img width="279" height="524" src="http://brasco.co/Mims/wp-content/uploads/shrekBeer.png" class="attachment-full" alt="shrekBeer" title="shrekBeer" />
</div><!-- End singleTint-->
</li>
Here’s my jQuery:
$('li.image-rollover').mouseover(function() {
$('img.glassreplace').attr({//Change the src and size info on hover
src: ('div.singleTint img', this).src,
width: '100%',
height: '100%'
});
});`
change this:
to: