JSFiddle - React, Tailwind, and code Playground
by alexdickson
HTML
<div>hello</div>
<p>Click somewhere!</p>
CSS
div {
background: red;
padding: 5px;
position: absolute;
top: 50px;
left: 50px;
}
JavaScript
$(document).click(function(event) {
var x = event.pageX,
y = event.pageY;
$('div').animate({
top: y,
left: x
}, 1000);
});