Author Topic: How to tracking and capture mouse position using jQuery  (Read 5465 times)

Offline admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 296
    • View Profile
How to tracking and capture mouse position using jQuery
« on: July 04, 2010, 01:02:45 PM »
<html>
How to tracking and capture mouse position using jQuery?

If you want to know the mouse pointer position and use in mouse click or move events you can use the following code:

Code: [Select]
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
   $(document).mousemove(function(e){
      $('#status').html(e.pageX +', '+ e.pageY);
   });
})
</script>
<body>
<h2 id="status">
0, 0
</h2>
</body>
</html>