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

Source: Internet
Author: User

This paper analyzes the difference between hover and mouseover and mouseout in jquery. Share to everyone for your reference, as follows:

It was thought in jquery that in fact mouseover and mouseout two events equals hover events. Two is no different, it should be the same. But yesterday an animated effect just let me see, these two do not equate.

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

Add an event to the wrapper and let the class= "point" layer enlarge when the mouse moves to the wrapper. However, if the mouseover and Mouseout events are used, the point layer will become larger when the mouse moves to the wrapper layer, but when the mouse moves between the IMG and the text layer, it will become larger and smaller, constantly changing. This is not the result we want, we want to be as long as the mouse on the wrapper layer, either IMG or text, point becomes larger, but the mouse does not move out of the wrapper layer, the point layer is not small.

Slowly thinking also clear, we do not have to mouseover and mouseout and use hover problem solved.

It is an exaggeration to think that it took us a long time to solve such a simple problem. Write a story for remembrance.

Add: Later find documents found in the jquery source code has this paragraph:

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

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

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

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.