jQuery hover example (#18492)

This commit is contained in:
Hovhannes
2018-10-14 18:18:11 +02:00
committed by Quincy Larson
parent 58a1a14f8c
commit 6d7e4aac85

View File

@ -11,6 +11,16 @@ $(selector).hover(inFunction, outFunction);
The first function, inFunction, will run when the ```mouseenter``` event occurs. The first function, inFunction, will run when the ```mouseenter``` event occurs.
The second function is optional, but will run when the ```mouseleave``` event occurs. The second function is optional, but will run when the ```mouseleave``` event occurs.
If only one function is specified, the other function will run for both the ```mouseenter``` and ```mouseleave``` events. If only one function is specified, the other function will run for both the ```mouseenter``` and ```mouseleave``` events.
Below is a more specific example.
```
$("p").hover(function(){
$(this).css("background-color", "yellow");
}, function(){
$(this).css("background-color", "pink");
});
```
So this means that hover on paragraph will change it's background color to yellow and the opposite will change back to pink.
### More Information ### More Information
More information can be found [here]. More information can be found [here].