To get the mouse position relative to the left and top edge of the page, event.pageX and event.pageY can be used.
<script> $("#pEventXEventY").bind("mousemove", function (e) { $(this).text("pageX: " + e.pageX + " pageY: " + e.pageY); }); </script>
In the above code, we have attached “mousemove” event in the paragraph whose id is “pEventXEventY”. When user moves mouse on this paragraph, the position of the mouse from left and top edge of the browser window will be written within this paragraph using e.pageX and e.pageY where e is the event argument passed in the declared function.
Views: 7505 | Post Order: 67