We will use jquery offset to determine the coordinates of the click in our specified div
$('#layoutSpace').click(function(e){
var offset = $(this).offset();
mouseX = (e.pageX - offset.left );
mouseY = (e.pageY - offset.top );
$('.axisXY').html("X: " + mouseX + " Y: " + mouseY);
});
LIVE DEMO click anywhere on the box
No comments:
Post a Comment