Differences between jquery hover and Mouseover and mouseout

Source: Internet
Author: User
Previously, I always thought that the Mouseover and mouseout events in jquery are equivalent to hover events. There is no difference between the two. They should be the same. However, I was only able to see an animated effect yesterday. These two cannot be the same.

<Div class = "wrapper">

<Div class = "IMG"> </div>

<Div class = "text"> </div>

</Div>

<Div class = "point"> </div>

Add events to wrapper. When you move the mouse over wrapper, the layer of class = "point" is enlarged. However, if the Mouseover and mouseout events are used, the point layer will become larger when the mouse moves to the wrapper layer,
However, when the mouse moves between the IMG and text layers, the point layer will become larger and smaller, changing constantly. This is not the result we want. What we want is to move the mouse over the wrapper layer,
Whether it is IMG or text, the point becomes larger, but the point layer remains small if the mouse is not removed from the wrapper layer.

The idea is clear, so we can solve the hover problem without using Mouseover and mouseout.

It took us a long time to solve such a simple problem. Write logs to commemorate.

Supplement: My master said that there is such a section in jquery source code:

Hover: function (fnover, fnout ){
Return this. mouseenter (fnover). mouseleave (fnout | fnover );
}
That is, hover! = Mouseover + mouseout. But hover = mouseenter + mouseleave.

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.