JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<div id="circle"></div>
</div>
CSS
body { overflow:hidden; position:absolute; height:100%; width:100%; background:#efefef; }
#circle {
height:50px;
width:50px;
margin-top:-32px;
margin-left:-32px;
background:red;
position:absolute;
top:50%;
left:50%;
border-radius: 50px;
}
JavaScript
$(document).ready(function() {
$("body").mousemove(function (e) {
$("#circle").stop();
handleMouseMove(e);
});
function handleMouseMove(event) {
var x = event.pageX,
y = event.pageY;
$("#circle").animate({
left: x,
top: y
}, 10);
}
});