I have a list with nested divs that are holding two images stacked above each other absolutely. I have established a hover effect that creates a smooth transition effect. However, the effect only triggers when the mouse is over the image and is not triggered when the mouse is above the link. Here is my code for a brief idea:
<ul id="shortcuts" class="sitewidth">
<li>
<a href="#">
<div class="shortcuticon box">
<img src="images/icon-learn.png" alt="" class="a">
<img src="images/icon-learn-hover.png" alt="" class="b">
</div>
</a>
</li>
<li>
<a href="#">
<div class="shortcuticon box">
<img src="images/icon-learn.png" alt="" class="a">
<img src="images/icon-learn-hover.png" alt="" class="b">
</div>
</a>
</li>
<li>
<a href="#">
<div class="shortcuticon box">
<img src="images/icon-learn.png" alt="" class="a">
<img src="images/icon-learn-hover.png" alt="" class="b">
</div>
<h2>Hello World!</h2>
</a>
</li>
<script type='text/javascript'>
$(document).ready(function(){
$("img.a").hover(function() {
$(this).stop().animate({"opacity": "0"}, "slow");
}, function() {
$(this).stop().animate({"opacity": "1"}, "slow");
});
});
</script>
</ul>
I do realize that the hove function should be done on #shortcuts li a
rather than the image itself. But this code is working and will give you a rough idea of what I'm looking for. Your kind help is very much appreciated.