A MooTools port of Andreas Waltl's jQuery TouchWipe. Gives easy access to left and right swipe events for iOS and other touch devices.
License: MIT-style.
new MooSwipe(el, options);
Typical usage:
new MooSwipe('swipe-id', {
onSwipeLeft: function() {
// Code to execute on left swipe
},
onSwipeRight: function() {
// Code to execute on right swipe
},
onSwipe: function(direction) {
// Code to execute on any swipe
}
});
Example:
new MooSwipe('swipe-id', {
tolerance: 50,
preventDefaults: false,
onSwipeLeft: ...,
onSwipeRight: ...,
onSwipe: ...
});
Event functions can be included in the MooSwipe initialization:
new MooSwipe('swipe-id', {
onSwipeLeft: function() { ... },
onSwipeRight: function() { ... },
onSwipe: function(direction) { ... }
});
Or added afterwards:
var swipe = new MooSwipe('swipe-id');
swipe.addEvent('swipeLeft', function() { ... });
swipe.addEvent('swipeRight', function() { ... });
swipe.addEvent('swipe', function(direction) { ... });
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus