jquery's differences about mouseover and MouseEnter

Source: Internet
Author: User

Native MouseEnter is a dom3-level event, and for some frameworks such as jquery, this event has been implemented. But what difference does it have with mouseover?

jquery when implementing both events, MouseOver supports event bubbling, registering events at the parent, and triggering this event for child elements. MouseEnter only the element that the mouse strokes to register the event will be triggered.

Look at an example:

<script type= "Text/javascript" src= "Http://code.jquery.com/jquery-1.11.1.min.js" ></script><script Type= "Text/javascript" >x=0;y=0;$ (document). Ready (function () {  $ ("Div.over"). MouseOver (function () {        $ ( ". over span"). Text (x+=1);  });  $ ("Div.enter"). MouseEnter (function () {        $ (". Enter span"). Text (y+=1);  }); </script><div class= "Over" style= "Background-color:lightgray;padding:20px;width:40%;float:left" >< H2 style= "Background-color:white;" > Triggered Mouseover event: <span></span>

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.