JSFiddle - React, Tailwind, and code Playground
by ciaoben
HTML
<p>Click anywhere to move the ball</p>
<div id="foo"></div>
CSS
p{padding-left:60px;}
#foo{
width:50px;
height:50px;
background:#c00;
position:absolute;
top:0;
left:0;
-moz-transition: all 12s;
-webkit-transition: all 12s;
-ms-transition: all 12s;
-o-transition: all 12s;
transition: all 12s;
}
JavaScript
var f = document.getElementById('foo');
document.addEventListener('click', function(ev){
f.style.left = (ev.clientX-25)+'px';
f.style.top = (ev.clientY-25)+'px';
},false);