JSFiddle - React, Tailwind, and code Playground
HTML
<div class="side">
<div id="follower"><a href="#">hello</a></div>
</div>
CSS
.side {
background-color: green;
height: 800px;
width:100px;
margin:50px;
}
#follower{
position : absolute;
background-color : red;
color : white;
padding : 10px;
}
JavaScript
var mouseX = 0, mouseY = 0;
$(".side").mousemove(function(e){
mouseY = e.clientY-19;
follower.html(mouseY);
});
// cache the selector
var follower = $("#follower");
yp = 0;
var loop = setInterval(function(){
yp += (mouseY - yp) / 6;
follower.css({top:yp});
}, 10);