JSFiddle - React, Tailwind, and code Playground

by J. Albert Bowden

HTML

<p>Click anywhere to move the ball</p>
<div id="foo"></div>

CSS

p{padding-left:60px;}
#foo{
border-radius:50px;
width:50px;
height:50px;
background:#c00;
position:absolute;
top:0;
left:0;
-moz-transition: all 1s; 
-webkit-transition: all 1s;  
-ms-transition: all 1s;  
-o-transition: all 1s;  
transition: all 1s;  
}

JavaScript

var f = document.querySelector('#foo');
document.addEventListener('click', function(ev){
    f.style.left = ev.clientX+'px';
    f.style.top = ev.clientY+'px';
},false);