.mousemove()
In this chapter you will learn:
Syntax and Description
.mousemove(handler)
.mousemove()
handler
is a function to execute each time the event is triggered.
Return value is the jQuery object, for chaining purposes.
mousemove
binds an event handler to the
mousemove
event, or trigger that event on an element.
.mousemove(handler)
is a shortcut for
.bind('mousemove', handler)
.
.mousemove()
is a shortcut for .trigger('mousemove')
.
For example:
<div id="target">Move here</div>
<div id="other">Other</div>
The event handler can be bound to the target:
$('#target').mousemove(function(event) {
$.print(event.pageX + ', ' + event.pageY);
});
We can also trigger the event when the second button is clicked.
$('#other').click(function() {
$('#target').mousemove();
});
Next chapter...
What you will learn in the next chapter:
- Syntax and Description for .mouseover() event
- How to listen to mouse over event
- How to change style for mouse over event