I have this code in jquery:
$(".pun").hover(function() {
$(".guns").show(0);
});
My html
<div class="pun">
<div class="guns">gun 1</div>
</div>
<div class="pun">
<div class="guns">gun 2</div>
</div>
<div class="pun">
<div class="guns">gun 3</div>
</div>
My css
.pun {
display:visible
}
.guns {
display:none
}
I want to do hover action display only the item that is being hovering. Now if you doing hover show every divs guns.
To show only the
gunsdiv that’s inside of thepundiv you’re hovering, use thefindfunctionOr provide a context for your selector
Also, the default for
showperforms no animation, so you can replace.show(0);with justshow();