Mouse MouseOver and Mouseout events

Source: Internet
Author: User

In the div you want to implement the mouse move-out effect, the first time is the jquery mouseout and mouseover events to achieve,

$ ('. Product '). MouseOver (function () {        ...}). Mouseout (function () {        ...});    

But when the mouse in the div inside the element moved also triggered the Mouseout event, the first time to think of their own code is not written wrong, but examined many times, found no problem,

Since there is no problem with the code, why does this happen? Behind the unexpected reason on the Internet search, the results found that there is really this situation, the solution is to use MouseLeave and MouseEnter

To implement the move-in removal effect.

Note that there may be errors when using MouseLeave instead of mouseout, but continuing to use mouseover will cause the MouseOver event to be triggered all the time.

So, the method in jquery is better to be paired, to avoid unnecessary errors.

Mouse MouseOver and Mouseout events

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.