Differences between hover, mouseover, and mouseout in jQuery,

Source: Internet
Author: User

Differences between hover, mouseover, and mouseout in jQuery,

This document analyzes the differences between hover, mouseover, and mouseout in jQuery. We will share this with you for your reference. The details are as follows:

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, when the mouse moves to the wrapper layer, the point layer will become larger, but when the mouse moves between the img and text layers, the point layer will become larger and smaller, constantly changing. This is not the result we want. What we want is that the point will become larger as long as the mouse is on the wrapper layer, whether it is img or text, however, when the mouse is not removed from the wrapper layer, the point layer remains unchanged.

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 an article 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.

I hope this article will help you with jQuery programming.

Articles you may be interested in:
  • How to Implement hover Event Synthesis Using jQuery
  • How to Use hover and toggle methods in jQuery
  • Examples of common events such as bind, hover, and toggle in jquery
  • Example of how jQuery's live () method handles hover events
  • Example of mouseover event usage in jQuery
  • Style flashing occurs when a child element exists in the extension Jquery plug-in for processing mouseover.
  • The difference between mouseleave and mouseout in jquery imitates the drop-down box Effect

Related Article

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.