Use jQuery's $. event. fix function to unify browser event processing _ jquery

Source: Internet
Author: User
The WEB Front-end developers know that different browsers have different ways to handle events. For example, if the element reference of the trigger event is in IE browser: event. srcElement: event.tar get in the FF browser. For example, in the FF browser, the position of the cursor relative to the page is event. pageX, and the processing methods in IE browser are different. Of course, there are also some examples such as "blocking event bubbling" and "canceling default browser behavior". Different browsers also have different processing methods, if we want JavaScript to properly process Event code in different browsers, we need to determine and process the Event code separately. Now jQuery provides us with a unified and compatible processing function $. event. fix (e). This function is not officially described in this document. It can be used when I read the Framework Code.
I. How to Use
The event compatibility Processing Using jQuery involves the following simple steps:
1. Reference The jQuery Framework library file in the header area of the webpage;
2. Define an event processing method and pass the event parameters in the called place;
3. Use $. event. fix to convert the old event into a new event reference;
4. Use the method and attribute of the event object after compatible processing after the event method.
Ii. Example

The Code is as follows:

Use jQuery's $. event. fix function to unify browser event processing

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: 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.