JSFiddle - React, Tailwind, and code Playground

by BramVanroy

HTML

<img src="http://noupe.com/img/wallpaper-3.jpg" /><br />
Position: <span id="info"></span>

CSS

img {margin: 50px;}

JavaScript

$(document).ready(function(){
    $('img').mousedown(function(e){
        var offset = {
            x: e.pageX - $(this).offset().left,
            y: e.pageY - $(this).offset().top
        }
            $('#info').html('{'+offset.x+'; '+offset.y+'}');
    });
});