.mousemove()

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() {
/*from   w  w  w .  j av a2 s .  com*/
 $('#target').mousemove();

});
Home »
  Javascript Tutorial »
    jQuery Reference »
      Event
Javascript Tutorial Event
Event
Event attributes
event.keycode
event.clientX/clientY
pageX/pageY
Cancel event
Event target
bind
.blur()
.change()
.click()
.error()
.dblclick()
.delegate()
.die()
.focus()
.hover()
.keydown()
.keypress()
.keyup()
.live()
.load()
.mousedown()
.mouseenter()
.mouseleave()
.mousemove()
.mouseover()
.mouseout()
.mouseup()
.off()
.on()
.one()
.ready()
.resize()
.scroll()
.select()
.submit()
.toggle()
.trigger()
.triggerHandler()
.unbind()
.undelegate()
.unload()