I am trying to replace an image with another image on rollover and use a fade.
I have 2 images water_bag.jpg and water_bag-hover.jpg
I am trying to replace one on rollover with the following javascript:
<script type="text/javascript">
$(document).ready( function() {
$('.my_img').parent().append($('.my_img').clone().attr('src','-hover.jpg').fadeIn('slow'))
});
</script>
My html is just this:
<a href="<?php echo tep_href_link(FILENAME_EVENTS); ?>"><img src="images/home_buttons/water_bag.jpg" alt="watch la vie en couleur" border="0" align="left" class="my_img" /></a>
What am I doing wrong?
Here’s simple way: set one image as a background, and fade in another on top:
JS:
DEMO: http://jsfiddle.net/Diodeus/gYyBL/