ztouch-Mobile Touch-screen development tool (zepto touch extension)

Source: Internet
Author: User

* Zepto.js v1.0.1 Touch Extend (zepto.js v1.0.1 's swipe touch extension) js-handles mobile mobile web touch gestures.

Zepto.js v1.0.1 version of the Touch.js module introduced after use will cause the page to be stuck, so a new extension has been developed to replace its touch.js. has been android/ios tested.

GitHub
* Ztouch Features:

Ztouch.js contains only the core function function, does not contain any effect, concise and lightweight;
Provides rich callback parameters that can be customized by the user to extend the effect (refer to Demo);
Support multiple callback functions to facilitate timely monitoring and event handling (instantiation of pre/post callback, Touch Start/move/end callback);
Support user-defined gesture standard definition (x-y axis sliding limit, angle limit);
Support box boundary detection, touch beyond the boundary automatically stop callback operation;
An internal property setting interface is provided to add user-defined attributes to the internal tpoint;
Supports horizontal swipe of gestures while keeping the browser sliding vertically;
does not block other binding events (onclick, etc.) within the box;
Support multi-touch monitoring (zoom, rotate);

Because the mobile browser will block JS on the gesture gesture event monitoring ztouch.js in the gesture listener interface although it can be called, but unable to implement gesture operation (Android device test, iOS device should support). We will perform a multi-touch event simulation in the follow-up solution. (the latest version of Ztouch has removed the gesture event monitoring method, the use of e.touches to monitor multi-touch, support two-point monitoring scaling and rotation operations)
GitHub
The core file for event monitoring in Ztouch.js. All the special effects can be customized in the callback function.
* The following callback functions are mainly available:

Beforecallback (the callback function that was triggered before instantiation),
Scallback (the callback function triggered when start Callback,touchstart),
Mcallback (the callback function triggered when move callback,touchmove),
Ecallback (the callback function triggered when end callback,touchend)
Aftercallback (the callback function triggered after instantiation),
* The touch Event correlation callback parameter is passed in the callback function:

Self: instanced box,
StartX: Contact Start x,
Starty: Contact Start y,
BL: (Box left) relative to the left offset of the document,
BT: (Box top) relative to the top offset of the document,
BW: (Box width) box widths,
BH: (box height) box height,
BRb: (Box right Border) box,
BBb: (Box Bottom Border) Box's lower border,
EndX: Contact end X;
EndY: Contact end y;
MX: (move x distance) x-direction sliding distance;
MY: (move y distance) sliding distance in y direction;
Direction: Gesture Slide direction (left/right/false);
Angle: Single point gesture sliding angle;
Duration: gesture duration;
Vendor: Browser prefix (-MOZ/-WEBKIT/-O/-MS);

Tpoint.multitouch: Whether multi-touch (touchmove can be monitored);
Tpoint.gstartdis: (gisture start distance) gesture starting distance;
Tpoint.genddis: (gisture end distance) gesture end distance;
Tpoint.scale: Gesture zoom ratio;
Tpoint.rotation: gesture rotation angle;
* Also provide an interface to modify internal tpoint data in the external callback function:

Tpoint.  SetAttr(name,value);      

* Call Method:

<Script type="Text/javascript">Incoming args initialization Parameter objectArgs={Inil:30,The minimum distance to slide in the x directionInit:50,Maximum distance for y-direction slidingEcallback:function(Tpoint){ Switch(Tpoint.Direction){ Case "Left": alert("left");  break;  case ' right ': alert("right");  }}}  $("Body").  Swipe(args);  </Script>               

* Project Address:

http://chinatjnet.github.io/zTouch/
* GitHub Address:

https://github.com/chinatjnet/zTouch/
* Demo Address:

Http://chinatjnet.github.io/zTouch/demo.html

Original address: http://blog.baiwand.com/?post=207

ztouch-Mobile Touch-screen development tool (zepto touch extension)

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: info-contact@alibabacloud.com 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.