Recently, because of the company's website to the previous campaign banner, when the user mouse across the display of the two-dimensional code. Like this mouse event control page element Explicit, the code farmers will often encounter, can be implemented by JavaScript or jquery code, below a few common needs to summarize together.
Mouseout and MouseLeave
There is a need to pay special attention to the difference between mouseout and MouseLeave. Let's look at the following code example:
<p style= "color: #333333; Font-family:-apple-system," FONT-SIZE:16PX; " = "" >
<! doctype html>
The effect is as follows:
Fadein and FadeoutThe previous example uses the show () and Hide () method, the foreground explicit effect instantaneous completion, in order to improve the actual user experience, here we introduce two more friendly "friends", namely Fadein and fadeout.
FadeIn: Method uses a fade-in effect to display the target element.
FadeOut: Method uses fade effect to hide target elements
These two methods can be configured with parameters to control the speed, such as slow, normal, fast, or the specified number of milliseconds.
Here we compare the effects of show (), Hide () with Fadein (), FadeOut (), with the following code:
<! doctype html>The effect is as follows:
SummaryIn this paper, we learn to learn through the JS or JQ implementation of mouse events Control page element explicit effect, the method is very simple. If you have a better solution, you are welcome to discuss the exchange.
Js/jquery implement mouse Control page element explicit