JSFiddle - React, Tailwind, and code Playground

by Shakti Patel

HTML

please don't move the mouse after your mouse enter the .area, then you will find the problem.
<div class="area"></div>
<div class="tooltip">www.CodingSerf.com</div>

CSS

.area{
    width:52px;
    height:52px;
    background: red;
    position: absolute;
    left:100px;
    top:100px;
    cursor: pointer;
}
.tooltip{
    display:none;
    position: absolute;
    left: 20px;
    top: 160px;
    background:green;
    color: #fff;
    z-index:100;
}

JavaScript

$('.area').on('mouseenter',function(){
    $('.tooltip').show();
}).on('mousemove', function(e){
   $('.tooltip').css({'top':e.pageY,'left':e.pageX});
}).on('mouseleave',function(){
    $('.tooltip').hide();
});

var offset = 10;
setInterval(function(){
    //$('.area').hide();
    $('.area').css({"-webkit-transform":"translate("+offset+"px,"+offset+"px)"});
    //$('.area').css({"left":offset+'px',"top":offset+'px'});
    offset += 10;
},1000);