là nó có thể nhận được cordinates từ một cột cụ thể từ một hình ảnh như nó sẽ nói khi tôi di chuột qua cột 1 nó sẽ cho tôi nó như cột 1 cordinate 1,1 và sau đó tôi di chuột qua cột 2 nó sẽ cho tôi nó giống như cột 2 cordinate 1,1làm thế nào để có được cordinates chỉ trong cột cụ thể trong một hình ảnh của một lưới
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<div><span id="image_coords_click"></span><span id="image_coords_now"> </span></div>
<img id="image" class="aligncenter" src="http://4.bp.blogspot.com/-c0lydOomMh8/UdMXTLn0frI/AAAAAAAAKdU/xa8kZMf23uQ/s721/100+number+grid.png" width="1475" height="1475" />
<script type="text/javascript">
$('#image').mousemove(function(event) {
\t window.current_x = Math.round(event.pageX - $('#image').offset().left);
\t window.current_y = Math.round(event.pageY - $('#image').offset().top);
\t window.current_coords = window.current_x + ', ' + window.current_y;
\t $('#image_coords_now').html('Column: ' + window.current_coords + '.');
}).mouseleave(function() {
\t $('#image_coords_now').html(' ');
}).click(function() {
\t $('#image_coords_click').html('Last click: ' + window.current_coords + '. ');
});
</script>
Tôi có ý tưởng cách thực hiện, tôi đang cố gắng tạo ví dụ – Leo
Tôi đã sửa đổi câu trả lời của mình, tôi hy vọng nó sẽ hữu ích – Leo