.hover( handlerIn, handlerOut )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, handlerOut )
-
handlerInA function to execute when the mouse pointer enters the element.
-
handlerOutA function to execute when the mouse pointer leaves the element.
-
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:
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
36
37
38
39
40
41
42
43
44
45
|
|
Demo:
To add a special style to table cells that are being hovered over, try:
|
1
2
3
4
5
6
7
|
|
To unbind the above example use:
|
1
|
|