[jQuery] Multiple Image Fade
Hi,
I'm trying to write a script to fade in/out some image thumbnails. I'm
trying to achieve the following:
1) Fade in/out individual thumbnails on thumbnail hover
2) Fade in/out all thumbnails of the a class when hovering over a text
link of the same class.
Everything works except that in #2 the images don't return to 0.5
opacity when the mouse leaves the text link.
I'm pretty new to jQuery, can anyone help me out? Here's my code:
<script type="text/javascript">
$(document).ready(function(){
$("img.thumb").fadeTo(1, 0.5); // fade when page loads
$("img.thumb").hover(
function() {
$(this).fadeTo(300, 1.0); // 100% on hover
},
function() {
$(this).fadeTo(300, 0.5); // 50% out
}
);
$("#work_list #name a").hover(
function() {
var post_id = $(this).attr("class");
$("img." + post_id).fadeTo(500, 1.0);
},
function() {
$("img." + post_id).fadeTo(500, 0.5);
}
);
});
</script>
Thanks so much!