I have a few thumbnails set up to fade on hover and reveal the post metadata. The problem is when I hover over one thumbnail, all of them fade.
You can see what I me开发者_开发问答an here: http://jsfiddle.net/LDs6C/10/
How can I make it so only the thumbnail I'm hovering over fades?
You're still matching all the images and descriptions in your hover
handler. You should restrict the selectors to the current thumbnail, e.g. by using this
as the selector context:
$('.thumbnail').hover(function() {
$('img', this).stop(true, true).fadeTo(400, 0.2);
$('.description', this).stop(true, true).fadeIn(400);
}, function() {
$('img', this).stop(true, true).fadeTo(400, 1);
$('.description', this).stop(true, true).fadeOut(400);
});
Updated fiddle here.
精彩评论