Analysis of the difference between hover and mouseover and mouseout in jquery _jquery

Source: Internet
Author: User
Tags wrapper

In this paper, the differences between hover and mouseover and mouseout in jquery are analyzed. Share to everyone for your reference, specific as follows:

Previously thought in jquery actually mouseover and mouseout two events equals hover events. Two is no different, it should be the same. But yesterday an animation effect to let me see, these two are not equal.

<div class= "wrapper" >
<div class= "img" ></div>
<div class= "text" ></div>
</div>
<div class= "point" ></div>

Add an event to the wrapper and enlarge the class= "point" when the mouse moves over the wrapper. However, if you use MouseOver and Mouseout events, when the mouse moved to the wrapper layer, point layer will become larger, but when the mouse in the IMG and the text between the move between the level will become large and small, constant changes. This is not the result we want, we want as long as the mouse on the wrapper layer, whether it is IMG or text, point on the larger, but in the mouse has not moved out of the wrapper layer, the point layer does not become smaller.

Slowly train of thought also clear, we do not need mouseover and mouseout and use hover problem to solve.

It is an exaggeration to say that it took us a long time to solve such a simple problem. Write an article as a souvenir.

Add: Later my master said that in fact there is a paragraph in the jquery source code:

Hover:function (Fnover, fnout) {return
 this.mouseenter (fnover). MouseLeave (Fnout | | fnover);
}

That means hover!. =mouseover+mouseout. But Hover=mouseenter+mouseleave.

I hope this article will help you with the jquery program design.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.