JSFiddle - React, Tailwind, and code Playground
by Brock Whittaker
HTML
<span></span>
<div class='a'></div>
<div class='b'></div>
JavaScript
$(document).ready(function () {
$(document).mousedown(function (event) {
a = event.pageX;
b = event.pageY;
$("span").text("X: " + a + ", Y: " + b);
});
$(document).mousemove(function (event) {
x = event.pageX;
y = event.pageY;
$(".a").text("X: " + x + ", Y: " + y);
});
$(document).mouseup(function (event) {
$(".b").text("X: " + (x - a) + ", Y: " + (y - b));
});
});