Handling Touch events allows you to track the position of each finger of the user. You can bind the following four kinds of touch events:
1 2 3 4 |
Touchstart://The finger on the screen when the trigger Touchmove://finger on the screen when the trigger touchend://finger from the screen when the trigger Touchcancel://System to cancel the touch of the event Time to trigger. As to when the system will be canceled, unknown |
1 2 3 4 |
Client/clienty://Touch point relative to the position of the browser window viewport Pagex/pagey://Touch point relative to the position of the page Screenx/screeny://Touch point relative to the position of the screen identifier: Unique ID of the touch object |
Http://blog.sina.com.cn/s/blog_65c2ec5e0101fexw.html
Handling Touch events allows you to track the position of each finger of the user. You can bind the following four kinds of touch events: 1.touchstart: // Fingers on the screen when the trigger 2.touchmove: // triggers 3.touchend: //when the finger moves on the screen When the finger is picked up from the screen, the trigger is triggered when the 4touchcancel: // system cancels the touch event. As to when the system will be canceled, the unknown property 1.client / clientY:// touch Point relative to the browser window viewport position 2.pageX / pageY:// position of touch point relative to page 3.screenx /screenY:// location of the touch point relative to the screen 4.identifier: // touch object unique ID //touchstart Events Function touchsatrtfunc (e) { //evt.preventdefault () //prevents the browser from zooming, scrolling, and so on when touching var touch = e.touches[0]; //gets the first contact var x = number ( Touch.Pagex); //page contact x coordinates var y = number (touch.pagey); // Page contact y-coordinate //record contact initial position startX = x; startY = y; } //touchmove events function touchmovefunc (e) { //evt.preventdefault (); //prevents the browser from zooming when touching, scroll bar scrolling etc var touch = evt.touches[0]; //get first Contact var x = number (Touch.pagex); //page Contact x coordinates var y = number (touch.pagey); //page Contact y-coordinate var text = ' Touchmove Event Trigger: (' + x + ', ' + y + ') '; //to judge the sliding direction if (x - startx != 0) { //sliding } if (y - starty != 0) { //sliding } }