Touch Event native must be bound with AddEventListenerFirst, the native
- Touchstart: triggered when touch starts
- Touches: List of all fingers currently on the screen
- Event.touches.length: Record the hand index touched by the moment
- Event.touches[0].screenx: Record the x-axis position of the first finger on the screen
- Event.touches[0].screeny: Record the position of the first finger on the y-axis of the screen
- Touchmove: Triggers when a finger moves through the screen
- Touchend: Trigger at end of touch
To prevent the page from toggling when you swipe the screen, you typically add a block default event:
Document.addeventlistener ("Touchstart",function () { event.preventdefault ();},false );
Second, touch.js
- Drag: Grabbing and dragging a target
- Dragend: Trigger at end of drag
- Swipe: swipe finger trigger
- Swipeleft: Swipe left to trigger
- Swiperight: Swipe right to trigger
- Swipeup: Swipe down to trigger
- Swipedown: Swipe up to trigger
- Tap: Click once to Trigger
- DOUBLETAP: Double-click Trigger
- Pinch: Capture gesture (zoom in or zoom out)
- Rotate: Rotation (two fingers)
Touch.on ("#div1", "rotate",function (EV) {var//ev.rotation Capture the angle of the current rotation if // Ev.fingerstatus capture Current finger State (start/motion/end)angle=newangle;} This // Setting the transform angle });
- Add in Touchstart:
Third, mobile event--deviceorientation (can do gravity game)
- EVENT.BETA:X Shaft
- EVENT.GAMMA:Y Shaft
- EVENT.ALPHA:Z Shaft
touch--Mobile End