Usage:
swipe(element,options)
- activate swipe on specified element
swipe(options);
- activate swipe on document
Options:
minDistance
- int
or string
- minimum distance between touch start and end positions
in pixels or in percents.
unselectable
- boolean
- disable text selection
onSwipeLeft
- function
- handler for swipe left
onSwipeRight
- function
- handler for swipe right
onSwipeUp
- function
- handler for swipe up
onSwipeDown
- function
- handler for swipe down
swipe(document.getElementbyId('target'),{
onSwipeRight: function(){
target.innerHTML = 'Right';
},
onSwipeLeft: function(){
target.innerHTML = 'Left';
},
onSwipeDown: function(){
target.innerHTML = 'Down';
},
onSwipeUp: function(){
target.innerHTML = 'Up';
},
minDistance: 0,
unselectable: true
});
swipe({
onSwipeRight: function(){
alert('Right');
},
onSwipeLeft: function(){
alert('Left');
},
onSwipeDown: function(){
alert('Down');
},
onSwipeUp: function(){
alert('Up');
},
minDistance: 0,
unselectable: false
});
swipe({
onSwipeRight: function(){
alert('Right');
},
onSwipeLeft: function(){
alert('Left');
},
onSwipeDown: function(){
alert('Down');
},
onSwipeUp: function(){
alert('Up');
},
minDistance: '10%',
unselectable: false
});