Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the parameters of the hover function in jquery

Shulou Source: shulou.com Published: 2022-05-31 16:59:26 09月22日 Update

This article mainly introduces the parameters of the hover function in jquery what the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe you will have something to gain after reading the parameters of the hover function in this jquery, let's take a look.

The hover function in jquery has two parameters: 1, the required parameter "inFunction", which is used to specify the event handler function that runs when the mouseenter event occurs; and 2, the optional parameter "outFunction", which is used to specify the event handler function that runs when the mouseleave event occurs.

The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.

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

This method triggers the mouseenter and mouseleave events.

Therefore, the hover function accepts two parameters: one is required and the other can be omitted.

Syntax:

The $(selector) .hover (inFunction,outFunction) parameter is required to describe inFunction. Specifies the function to run when the mouseenter event occurs. OutFunction is optional. Specifies the function to run when the mouseleave event occurs.

Note: if only one function is specified, it will run on the mouseenter and mouseleave events.

Example: when the mouse pointer hovers over it, change the

The background color of the element

$(document) .ready (function () {$("p") .hover (function () {$("p") .css ("background-color", "yellow") }, function () {$("p") .css ("background-color", "pink");})

Move the mouse to the paragraph.

This is the end of the article on "what are the parameters of the hover function in jquery?" Thank you for reading! I believe you all have a certain understanding of the knowledge of "what are the parameters of the hover function in jquery". If you want to learn more, you are welcome to follow the industry information channel.

Tags: Functions parameters events runs birth time knowledge mouse two elements content pointers methods articles processing value simple operation tutorials articles easy to understand more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Linux Microsoft macOS vpn