Display the mouse position relative to the left and top edges of the document (within this iframe) using jquery
- جي كويري
- 2021-09-18
- mhanasmh00489829403
الأجوبة
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 );
});
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
معلومات ذات صلة