jQuery mousemove() 方法

jQuery 教程 · 2019-03-26 13:59:27

实例

获得鼠标指针在页面中的位置:

$(document).mousemove(function(event){
$("span").text(event.pageX + ", " + event.pageY);
});

定义和用法

当鼠标指针在指定的元素中移动时,就会发生 mousemove 事件。

mousemove() 方法触发 mousemove 事件,或添加当发生 mousemove 事件时运行的函数。

注意:用户把鼠标移动一个像素,就会发生一次 mousemove 事件。处理所有 mousemove 事件会耗费系统资源。请谨慎使用该事件。

语法

触发被选元素的 mousemove 事件:

  
    $(selector).mousemove()
  
  

添加函数到 mousemove 事件:

  
    $(selector).mousemove(function)

  

参数 描述
function 可选。规定 mousemove 事件触发时运行的函数。

点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html

查看所有标签

Programming Python

Programming Python

Mark Lutz / O'Reilly Media / 2006-8-30 / USD 59.99

Already the industry standard for Python users, "Programming Python" from O'Reilly just got even better. This third edition has been updated to reflect current best practices and the abundance of chan......一起来看看 《Programming Python》 这本书的介绍吧!

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具