I have a resized image (with width="100") and a jquery script to output the current coordinates when I click that image.
<img id="image" src="http://localhost/image.jpg" width="100" >
<script>
$('#image').mousemove( function(event) {
window.current_x = Math.round(event.pageX - $('#image').offset().left) ;
window.current_y = Math.round(event.pageY - $('#image').offset().top);
window.current_coords = window.current_x + ', ' + window.current_y;
$('#edit_instants_now').html('Current position: ' + window.current_coords + '.');
}).mouseleave( function() {
$('#edit_instants_now').html(' ');
}).click( function() {
$('#edit_instants_click').html('Last click: ' + window.current_coords + '. ');
document.edit_instant.edit_instant_x.value = window.current_x;
document.edit_instant.edit_instant_y.value = window.current_y;
});
</script>
The problem is that I want to get the actual coordinates of the original image and not the resized one.
Do you have any suggestions? Thanks.