JSFiddle - React, Tailwind, and code Playground
by wdm954
HTML
<p>Lorem ipsum ador abmium abset.<br />
The quick brown fox <a href="#" class="hasTooltip">jumped</a><span>Did he really jump, or was this fake? I'm not sure. Do some research on this later.</span> hastily over the obese, lazy <a href="#" class="hasTooltip">dog</a><span>Lots of dogs.</span>.
</p>
CSS
.hasTooltip + span {
display:none;
}
.showTooltip {
background-color: black;
color: white;
padding:5px;
margin-top: 1.3em;
position: absolute;
max-width: 200px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
JavaScript
$('.hasTooltip').hover(function() {
var offset = $(this).offset();
$(this).next('span').fadeIn(200).addClass('showTooltip');
$(this).next('span').css('left', offset.left + 'px');
}, function() {
$(this).next('span').fadeOut(200);
});