Permalink
Browse files

Merge branch 'master' of https://github.com/riklomas/zepto into riklo…

…mas-master

Conflicts:
	README.rdoc
	src/touch.js
  • Loading branch information...
2 parents 7e10f96 + 1182eed commit 53cc4c7668f662a55c4d5316911338138a0d8802 @madrobby committed Dec 17, 2010
Showing with 27 additions and 3 deletions.
  1. +11 −0 README.rdoc
  2. +4 −3 src/touch.js
  3. +6 −0 test/touch_functional.html
  4. +6 −0 test/touchcancel_functional.html
View
@@ -134,6 +134,17 @@ Double-tapping:
Swiping (e.g. "delete" button when swiping over a list entry):
$('some selector').swipe(function(){ ... });
+<<<<<<< HEAD
+=======
+
+Swiping left:
+ $('some selector').swipeLeft(function(){ ... });
+
+Swiping right:
+ $('some selector').swipeRight(function(){ ... });
+
+= Ajax:
+>>>>>>> 1182eedd3d59aec75b173b8723428439382b1cfe
= Ajax
View
@@ -20,7 +20,8 @@
$(touch.target).trigger('doubleTap');
touch = {};
} else if (touch.x2 > 0) {
- Math.abs(touch.x1 - touch.x2) > 30 && $(touch.target).trigger('swipe');
+ Math.abs(touch.x1 - touch.x2) > 30 && $(touch.target).trigger('swipe') &&
+ $(touch.target).trigger('swipe' + (touch.x1 - touch.x2 > 0 ? 'Left' : 'Right'));
touch.x1 = touch.x2 = touch.last = 0;
} else if ('last' in touch) {
touchTimeout = setTimeout(function(){
@@ -32,7 +33,7 @@
}).bind('touchcancel', function(){ touch = {} });
});
- ['swipe', 'doubleTap', 'tap'].forEach(function(gesture){
- $.fn[gesture] = function(callback){ return this.bind(gesture, callback) }
+ ['swipe', 'swipeLeft', 'swipeRight', 'doubleTap', 'tap'].forEach(function(m){
+ $.fn[m] = function(callback){ return this.bind(m, callback) }
});
})(Zepto);
@@ -25,6 +25,12 @@
})
.swipe(function(){
$(this).append(' | swipe!');
+ })
+ .swipeLeft(function(){
+ $(this).append(' | swipe left!');
+ })
+ .swipeRight(function(){
+ $(this).append(' | swipe right!');
});
</script>
</body>
@@ -27,6 +27,12 @@
})
.swipe(function(){
$(this).append(' | swipe!');
+ })
+ .swipeLeft(function(){
+ $(this).append(' | swipe left!');
+ })
+ .swipeRight(function(){
+ $(this).append(' | swipe right!');
});
</script>
</body>

0 comments on commit 53cc4c7

Please sign in to comment.