I created a callout as follows. As you can see, the callout not being hidden when I hover out from the i
icon. Do I use the wrong event? I tried switching mouseover
and mouseleave
but the callout looks blinking.
Any help appreciated! :)
$(".text-with-tooltip i").hover(function() {
$(".callout-tooltip").show();
});
.text-with-tooltip {
font-size: 13px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.text-with-tooltip i {
margin-left: 4px;
font-size: 11px;
}
.callout.callout-tooltip {
height: 60px;
width: 200px;
float: left;
}
.callout.callout-tooltip {
background-color: rgba(0,0,0,0.8);
color: #ccc;
padding: 8px;
padding-bottom: 4px;
border-radius: 3px;
min-height: 50px;
border: 1px solid #333;
text-shadow: 0 0 1px #000;
text-align: center;
font-size: 12px;
position: absolute;
top: 28%;
left: 50%;
transform: translate(-50%, -28%);
display: none;
}
.callout.callout-tooltip::before {
content: "";
width: 0px;
height: 0px;
border: 0.8em solid transparent;
position: absolute;
}
.callout.callout-tooltip.top::before {
left: 45%;
bottom: -20px;
border-top: 10px solid rgba(0,0,0,0.8);
}
.tooltip-wrapper {
height: 400px;
width: 100%;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.11/css/all.css" integrity="sha384-p2jx59pefphTFIpeqCcISO9MdVfIm4pNnsL08A6v5vaQc4owkQqxMV8kg4Yvhaw/" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700,700i" rel="stylesheet">
<div class="tooltip-wrapper">
<div class="text-with-tooltip">Manual<i class="fas fa-info-circle"></i></div>
</div>
<div class="callout top callout-tooltip">You must enter the request number every time you add new entry on Reimbursement Entry</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>