jquery mousemove() method


  Translation results:

mouse

English [maʊs] American [maʊs]

n. Mouse; mouse; shy [timid] person; [informal term] eye bruises on the head

vi.Catch mice; spy, secretly search

move

英[mu:v] 美[muv]

vt.& vi. move, move

vi.action; move; progress; (machine, etc.) start

vt. propose; move; shake; change

n.Change;Migration

jquery mousemove() methodsyntax

Function:When the mouse pointer moves within 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. When the user moves the mouse one pixel, a mousemove event occurs. Handling all mousemove events consumes system resources. Please use this event with caution.

Trigger the mousemove event syntax: $(selector).mousemove()

Bind the function to the mousemove event syntax: $ (selector).mousemove(function)

Parameters: function Optional. Specifies a function to run when a mousemove event occurs.​

jquery mousemove() methodexample

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $(document).mousemove(function(e){
    $("span").text(e.pageX + ", " + e.pageY);
  });
});
</script>
</head>
<body>
<p>鼠标位于坐标: <span></span>.</p>
</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A