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