What is the function of hover method in jquery

藏色散人
Release: 2021-11-12 10:33:40
Original
2462 people have browsed it

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)
Copy after login

Call:

$( selector ).hover( handlerIn, handlerOut )
Copy after login

Equivalent to the following:

$( selector ).mouseenter( handlerIn ).mouseleave( handlerOut );
Copy after login

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

Call:

$(selector).hover(handlerInOut)
Copy after login

Equivalent to:

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!