.hover( handlerIn(eventObject), handlerOut(eventObject) )Returns: jQuery
Description: Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.
version added: 1.0.hover( handlerIn(eventObject), handlerOut(eventObject) )
The .hover()
method binds handlers for both mouseenter
and mouseleave
events. You can use it to simply apply behavior to an element during the time the mouse is within the element.
Calling $(selector).hover(handlerIn, handlerOut)
is shorthand for:
1 |
|
See the discussions for .mouseenter()
and .mouseleave()
for more details.
Examples:
Example: To add a special style to list items that are being hovered over, try:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
Example: To add a special style to table cells that are being hovered over, try:
1 2 3 4 5 6 7 8 |
|
Example: To unbind the above example use:
1 |
|