I have multiple div boxes with the class printPic which will have their own unique id. On hover in/out, toggle the display of printPicOverlay which is a child of printPic. The way I have it set up now, printPicOverlay for all ids are toggled on hover.
What would be the best way to show/hide printPicOverlay on hover for each individual id?
$(".printPic").hover(function () {
$(".printPicOverlay").toggle();
}, function () {
$(".printPicOverlay").toggle();
});
.printPic{
height: 10em;
width: 10em;
display: inline-block;
background: red;
position: relative;
}
.printPicOverlay{
height: 100%;
width: 100%;
background: rgba(0,0,0,0.4);
display: none;
position: absolute;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class = "printPic" id = "1">
<div class = "printPicOverlay"></div>
</div>
<div class = "printPic" id = "2">
<div class = "printPicOverlay"></div>
</div>
<div class = "printPic" id = "3">
<div class = "printPicOverlay"></div>
</div>