Reputation: 277
when I hover over my div the pop up fades in like it should but it affects all the other divs with the same class as well. I just want it to effect the div that's being hovered on. Any help would be appreciated. Thank you!
$(document).ready(function() {
$(".project").hover(function() {
$('.caption').fadeToggle(1000);
});
});
Upvotes: 2
Views: 70
Reputation: 253318
Simply provide a context:
$(".project").hover(function() {
$(this).find('.caption').fadeToggle(1000);
});
With this approach, jQuery will look at the current .project
element and look within that element for descendant elements with the class of caption
; rather than looking at the whole document.
Upvotes: 5