How to use JQuery Event mousemove() Method

This article describe about jQuery Event mousemove() Method.
  • 2244

jQuery Event mousemove() Method

When the mouse pointer moves within a certain element then mouseover event occurs.

The mousemove() method triggers the mousemove event, it is also define what will happens when mousemove event occurs.

Note: User move the mouse one pixel then mousemove event generate. And mousemove events also take the system resources for the process. That is why use this event carefully.

Example

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function () {

        $(document).mousemove(function (e) {

            $("span").text(e.pageX + ", " + e.pageY);

        });

    });

</script>

</head>

<body>

<p>Mouse coordinates is at: <span></span>.</p>

</body>

</html>

 

Output

 

mousemove method pic51.jpg

 

Trigger the mousemove Event

Generate trigger of mouseover event for  selected element.

 

Syntax

 

$(selector).mousemove()

 

Bind a Function to the mousemove Event

It is define a function to run when mousemove event is triggered.

 

Syntax

 

$(selector).mousemove(function)

 

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.