JSFiddle - React, Tailwind, and code Playground
HTML
<div></div>
CSS
div {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: #ccc;
cursor: crosshair;
}
JavaScript
var currentPos=[];
$("div").on({
mousemove: function(e) {
if (e.pageX!==currentPos[0] && e.pageY !==currentPos[1]){
currentPos=[e.pageX,e.pageY];
this.innerHTML = "Event: " + e.type;
console.log("move");
}
},
click: function(e) {
this.innerHTML = "Event: " + e.type;
console.log("click");
}
});