{"name":"hover","type":"method","title":".hover()","deprecated":null,"removed":null,"desc":"Bind one or two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.","categories":["events/mouse-events","version/1.0"],"entries":[{"return":"jQuery","signatures":{"added":"1.0","argument":[{"desc":"A function to execute when the mouse pointer enters the element.","name":"handlerIn(eventObject)","type":"Function"},{"desc":"A function to execute when the mouse pointer leaves the element.","name":"handlerOut(eventObject)","type":"Function"}]},"examples":[{"desc":"To add a special style to list items that are being hovered over, try:","code":"\n$( \"li\" ).hover(\n function() {\n $( this ).append( $( \" ***\" ) );\n }, function() {\n $( this ).find( \"span:last\" ).remove();\n }\n);\n\n$( \"li.fade\" ).hover(function() {\n $( this ).fadeOut( 100 );\n $( this ).fadeIn( 500 );\n});\n","css":"\n ul {\n margin-left: 20px;\n color: blue;\n }\n li {\n cursor: default;\n }\n span {\n color: red;\n }\n","html":"\n
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:
\n$( selector ).mouseenter( handlerIn ).mouseleave( handlerOut );\n \n See the discussions for .mouseenter() and .mouseleave() for more details.
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:
\n$( selector ).mouseenter( handlerIn ).mouseleave( handlerOut );\n \n See the discussions for .mouseenter() and .mouseleave() for more details.