<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery $(selector).mousemove() 事件</title> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script> <script> /*参考:https://www.runoob.com/jquery/event-mousemove.html * 知识点: * 1.$(selector).mousemove(function) * function, 可选。规定 mousemove 事件触发时运行的函数。 * 注意:用户把鼠标移动一个像素,就会发生一次 mousemove 事件。 * 处理所有 mousemove 事件会耗费系统资源。请谨慎使用该事件。*/ $(document).ready(function () { $(document).mousemove(function (event) { console.log(event.pageX, event.pageY); $("span").text(event.pageX + ", " + event.pageY); }); }); </script> </head> <body> <p>鼠标指针的坐标是: <span></span>.</p> </body> </html>
jQuery $(selector).mousemove() 事件.html
最新推荐文章于 2020-11-09 18:26:07 发布