Overview
Bind a handler function to the mousemove event of each matching element.
The mousemove event is triggered by moving the mouse over an element. Event processingThe function will be passed a variable - the event object, its .clientX and .clientY AttributesRepresents the coordinates of the mouse
Parameters
fnFunctionV1 .0
The handler function bound in the mousemove event of each matching element.
[data],fnString,FunctionV1.4.3
data:mousemove([Data], fn) Data can be passed in for function fn to process.
fn: The handler function bound in the mousemove event of each matching element.
Example
Description:
Get the position of the mouse pointer in the page:
jQuery Code:
$(document).mousemove(function(e){ $("span").text(e.pageX + ", " + e.pageY); });
Example
Get the position of the mouse pointer on the page:
$(document).mousemove(function(e){ $("span").text(e.pageX + ", " + e.pageY); });
Definition and usage
When the mouse pointer moves in the specified element, the mousemove event occurs.
The mousemove() method triggers the mousemove event, or specifies a function to run when the mousemove event occurs.
Note: When the user moves the mouse one pixel, a mousemove event will occur. Handling all mousemove events consumes system resources. Please use this event with caution.
Trigger the mousemove event
Syntax
$(selector).mousemove()
Add a function to the mousemove event:
$(selector).mousemove(function)
Parameters Description
function Optional. Specifies the function to run when the mousemove event fires.
The above is the detailed content of jQuery: usage and definition of mousemove event. For more information, please follow other related articles on the PHP Chinese website!