JSFiddle - React, Tailwind, and code Playground
by lollero
HTML
<div id="box"></div>
<div id="tooltip">Tooltip</div>
CSS
#box { width: 200px; height: 150px; background: f9f9f9; border: 2px solid #e1e1e1; margin: 30px;}
#tooltip {
position: absolute;
top: 0px;
left: 0px;
display: none;
}
JavaScript
$("#box").mousemove(function(e){
$("#tooltip").fadeIn( 300 );
$("#tooltip").css({
top: ( e.pageY + 10 ) + "px",
left: ( e.pageX + 10 ) + "px"
});
});
$("#box").mouseout(function(){
$("#tooltip").fadeOut( 300 );
});