jQuery mousemove() method
Example
Get the position of the mouse pointer on the page:
$(document).mousemove(function(event){
$("span").text(event.pageX + ", " + event.pageY);
});
Try it »
Definition and Usage
The mousemove event occurs when the mouse pointer moves within the specified element.
The mousemove() method triggers the mousemove event, or adds a function to run when a mousemove event occurs.
**Note:** A mousemove event occurs every time the user moves the mouse one pixel. Handling all mousemove events consumes system resources. Use this event with caution.
Syntax
Trigger the mousemove event of the selected element:
$(
selector
).mousemove()
Try it
Add a function to the mousemove event:
$(
selector
).mousemove(
function
)
Try it
| Parameters | Description |
|---|---|
| function | Optional. Specifies the function to run when the mousemove event is triggered. |
jQuery event methods