Description:
In this article, I will explain how to get mouse
cursor position using Jquery.
When the DOM is ready,
we are calling for mousemove event. Whenever user moves the mouse then this
event gets called and we bind the pageX and pageY property with the output
element.
pageX, pageY - used to
retrieve x and y coordinates of the page.
Example Program:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script
type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script
type="text/javascript">
$(document).ready(function () {
$(document).mousemove(function (e) {
$('#MouseValue').html("X Axis : " + e.pageX + " Y Axis : " + e.pageY);
});
});
</script>
</head>
<body>
<form
id="form1"
runat="server">
<div
id="MouseValue">
</div>
</form>
</body>
</html>
Get mouse position with Jquery , how to get mouse
Cursor position with Jquery, Jquery get mouse position, Get cursor position
using Jquery, Find mouse position using Jquery, find cursor x and y
coordinates, Get the mouse coordinates
0 comments:
Post a Comment