jquery event.screenX-Y_clientX-Y_offsetX-Y.html
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jquery event.screenX-Y_clientX-Y_offsetX-Y</title> <style> * { margin: 0; padding: 0; } div { width: 200px; height: 200px; background-color: red; } </style> <script src="jquery-1.11.3.js"></script> <script> $(function () { // click, mousemove $("div").mousemove(function (event) { console.log("event:", event); console.log(""); console.log("offset:"); console.log(event.offsetX + ":" + event.offsetY); console.log("client:"); console.log(event.clientX + ":" + event.clientY); console.log("screen:"); console.log(event.screenX + ":" + event.screenY); }); }); </script> </head> <body> <div></div> </body> </html>
知识图: