Reputation: 14042
so I have this html:
<div>
<div>
<a class="member-img" href="#" >
<img src="image.jpg" alt="member">
</a>
</div>
<div class="member-bar">
</div>
</div>
and i try to select "member-bar" when the user hovers "member-img"
$('.member-img').hover(function(){ $(this).closest(".member-bar").slideDown() });
but it doesn't seem to work, any help for this code ?
Upvotes: 0
Views: 45
Reputation: 78595
member-bar
would need to be a parent of member-img
in order for that to work. You need to first find the parent, then find member-bar
as a sibling:
$(".member-img").hover(function() {
$(this).parent().next(".member-bar").slideDown();
});
Here's a fiddle for the above code
Upvotes: 1