Get event clientX clientY
Description
The following code shows how to get event clientX clientY.
Example
<html>
<head>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {<!--from ww w . j a v a2s . c om-->
$("div").mouseover(function(e) {
var pageCoords = "( " + e.pageX + ", " + e.pageY + " )";
var clientCoords = "( " + e.clientX + ", " + e.clientY + " )";
$("span:first").text("( e.pageX, e.pageY ) - " + pageCoords);
$("span:last").text("( e.clientX, e.clientY ) - " + clientCoords);
});
});
</script>
</head>
<body>
<div>
<span>Move the mouse over the div.</span> <span> </span>
</div>
<div>java2s.com</div>
</body>
</html>