Latest web development tutorials

jQuery mousemove () method

jQuery Event Methods jQuery Event Methods

Examples

Get the mouse pointer position in the page:

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

try it"

Definition and Usage

When the mouse pointer moves in the specified element, the event will mousemove.

mousemove () method triggers mousemove event or add a function to run when the event occurs mousemove.

Note: You move the mouse one pixel, once mousemove event occurs.It handles all mousemove event will consume system resources. Be careful with this event.


grammar

Trigger the selected element mousemove events:

$(selector).mousemove() 尝试一下

Adding Functions to mousemove event:

$(selector).mousemove(function) 尝试一下

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


jQuery Event Methods jQuery Event Methods