Q:

Display the mouse position relative to the left and top edges of the document (within this iframe) using jquery

0

Display the mouse position relative to the left and top edges of the document (within this iframe) using jquery

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

HTML Code :

<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-git.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Display the mouse position relative to the left and top edges of the document (within this iframe).</title>
</head>
<body>
<div id="position"></div>
</body>
</html>

CSS Code :

 body {
 background-color: #CCDD96;
 }
 div {
 padding: 20px;
 }
JavaScript Code :
$( document ).on( "mousemove", function( event ) {
$( "#position" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
});

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now