JSFiddle - React, Tailwind, and code Playground
HTML
<div><a href="#" id="example1">CLICK</a></div>
<div id="example1-xy">X Y</div>
<div id="ship">>></div>
CSS
#example1
{
position: absolute;
left: 100px;
}
#ship
{
position: absolute;
}
JavaScript
$(document).ready(function() {
$('#example1').click(function(e){
var x = e.pageX - this.offsetLeft;
var y = e.pageY - this.offsetTop;
$('#example1-xy').html("X: " + x + " Y: " + y);
var leftOfShip = x;
//var leftOfShip = document.getElementById("ship").style.left + 20;
$("#ship").animate({left : leftOfShip},5000);;
});
});