How can I remove the class hide
from a div with the class popover
when hovering over each link? I have tried implementing the code below, but it doesn't seem to be working as expected.
$(document).ready(function() {
$(".myPopover").each(function() {
var doc = $(this);
doc.mouseover(function() {
doc.find('.popover').removeClass('hide').addClass('show');
});
});
});
.popover {
width: 240px;
padding: 10px;
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.15);
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, .2);
z-index: 1000000;
position: relative;
top: 10px;
transition: 1s;
background-color: #fff;
}
.popover.hide {
opacity: 0;
}
.popover.show {
opacity: 1;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a href="#" class="myPopover">help</a>
<div class="popover hide">
<h4>title</h4>
<p>content</p>
</div>
<a href="#" class="myPopover">help2</a>
<div class="popover hide">
<h4>title2</h4>
<p>content2</p>
</div>