Home  >  Article  >  Web Front-end  >  What is the function of hover method in jquery

What is the function of hover method in jquery

藏色散人
藏色散人Original
2021-11-12 10:33:402454browse

The hover method in jquery specifies two functions to be run when the mouse pointer hovers over the selected element. Its usage syntax is "$(selector).hover(inFunction,outFunction)".

What is the function of hover method in jquery

The operating environment of this article: windows7 system, jquery3.2.1 version, DELL G3 computer

#What is the function of the hover method in jquery?

jQuery hover() method:

hover() method specifies two functions to be run when the mouse pointer hovers over the selected element.

Method triggers mouseenter and mouseleave events.

Note: If only one function is specified, both mouseenter and mouseleave will execute it.

Syntax

$(selector).hover(inFunction,outFunction)

Call:

$( selector ).hover( handlerIn, handlerOut )

Equivalent to the following:

$( selector ).mouseenter( handlerIn ).mouseleave( handlerOut );

Note: If only one function is specified, it will be in mouseenter and Run on mouseleave event.

Call:

$(selector).hover(handlerInOut)

Equivalent to:

$( selector ).on( "mouseenter mouseleave", handlerInOut );

Parameters

inFunction required. Specifies the function to run when the mouseenter event occurs.

outFunction Optional. Specifies the function to run when the mouseleave event occurs.

Recommended learning: "jquery video tutorial"

The above is the detailed content of What is the function of hover method in jquery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn