As Zepto manages touch events, it connects listeners with events touchstart, touchendand touchmoveon document.body. It then calculates which event sends and fires the event for the element that received the event touchstart. This event then breaks through the DOM tree, invoking listeners for each element.
This gives us two ways to prevent swipe events:
First, you can do something like:
$('#my-child-element').bind('touchstart touchend touchup', function(event) {
event.stopPropagation();
});
When your child receives one touch event, this will prevent it from propagating to the parent elements, and most importantly the body tag. This prevents the Touch Zepto processor from doing anything by blocking frame-by-frame, tap, singleTap, longTap, and DoubleTap events while working on this element.
, , :
$('#my-child-element').bind('swipeLeft swipeRight', function(event) {
event.stopPropagation();
});
- Zepto , . Zepto tap .
: http://jsfiddle.net/bnickel/dUuUd/