JSFiddle - React, Tailwind, and code Playground

by Kirubel Girma

HTML

<div class="circle" id="a"></div>

CSS

body {
  height: 100%;
  width: 100%;
  position: absolute;
}

.circle {
  width: 3em;
  height: 3em;
  border-radius: 100%;
  background-color: magenta;
  position: absolute;
}

JavaScript

document.getElementsByTagName("BODY")[0].addEventListener("mousemove",
  function() {
    a = a + 1
    y = document.getElementById("a").style.top = event.clientY - 35 + 'px';
    x = document.getElementById("a").style.left = event.clientX + - 35 + 'px';

  })
  
  document.getElementsById("a")[0].addEventListener("onClick",
  function() {
  	
  }
);