First, the mobile side of the three major events 1, Finger press Ontouchstart 2, Finger touch ontouchmove 3, finger lift ontouchend
// Note: In mobile development, the browser emulator is good and bad, generally do not onx the way to bind event functions, to use event binding method (that is, the second type) function () {};d Iv.addeventlistener (function() {});
Second, PC-side events on the mobile side (problems) 1, PC-side events on the mobile side slightly slow, about 300ms 2, block PC events
function (EV) { ev.preventdefault ();});
functions and problems:1, mobile point through the problem: when the upper element occurs when clicked, the underlying element also has the click Feature. After 300ms, if the upper element disappears or hides, the target point will "drift" to the underlying element, triggering the Click Behavior Resolution: Act 1. The lower layer does not use elements with focus attributes (such as a or other element with click Behavior) Method 2. Block PC Events
function (EV) { ev.preventdefault ();}); P.addeventlistenr (function() { // This side click Changed to Touchstart alert (111) ;});
2, to solve the IOS10 in the meta-user zoom function 3, to solve the IOS10 overflow hidden problem 4, prohibit the system default scroll bar 5, prohibit long press the selected text, picture, system default Menu 6. Problem: Blocking the element's focus behavior
// Workaround (Resolve the input box because the document's blocking event does not focus on the problem) function (EV) { ev.stoppropagation ();});
Third, the Mobile event object (when a binding event function is added to an element, the default first parameter of the event function is the event object.) Event object: The user triggers a behavior under the browser, and the event object records details about the user's actions (such as location information, etc.). 1, touches: currently inscreen (including DOM elements)List of all fingers on 2, targettouches: in the currentDOM Element (not available outside the current DOM element)List of the fingers of 3,changedtouches: An example of a list of fingers that involve the current event: Mobile Seamless Carousel Switching
05 Mobile-Side events