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 mouseDown = {x: null, y: null};
$("div").on({
mousemove: function(e) {
if ( e.clientX !== mouseDown.x || e.clientY !== mouseDown.y) {
this.innerHTML = "Event: " + e.type;
console.log("move");
}
},
click: function(e) {
mouseDown = { x: e.clientX, y: e.clientY };
this.innerHTML = "Event: " + e.type;
console.log("click");
}
});