TouchSwipe a jQuery plugin for touch devices.
TouchSwipe is a jquery plugin to be used with jQuery on touch input devices such as iPad, iPhone etc.
Features
- Detects swipes in 4 directions, "up", "down", "left" and "right"
- Supports single finger or double finger touch events
- Supports click events both on the touchSwipe object and its child objects
- Definable threshold to determin when a gesture is actually a swipe
- Events triggered for swipe "start","move","end" and "cancel"
- End event can be triggered either on touch release, or as soon as threshold is met
- Allows swiping and page scrolling
Demos
Options
- swipe
- Funciton:null A catch all handler that is triggered for all swipe directions.
- Handler is passed 3 arguments
- event : the original event object
direction: the direction of the swipe : "left", "right", "up", "down".
distance: the distance of the swipe
- swipeLeft
- Funciton:null A handler that is triggered for "left" swipes.
- Handler is passed 3 arguments
- event : the original event object
direction: the direction of the swipe : "left", "right", "up", "down".
distance: the distance of the swipe
- swipeRight
- Funciton:null A handler that is triggered for "right" swipes.
- Handler is passed 3 arguments
- event : the original event object
direction: the direction of the swipe : "left", "right", "up", "down".
distance: the distance of the swipe
- swipeUp
- Funciton:null A handler that is triggered for "up" swipes.
- Handler is passed 3 arguments
- event : the original event object
direction: the direction of the swipe : "left", "right", "up", "down".
distance: the distance of the swipe
- swipeDown
- Funciton:null A handler that is triggered for "down" swipes.
- Handler is passed 3 arguments
- event : the original event object
direction: the direction of the swipe : "left", "right", "up", "down".
distance: the distance of the swipe
- swipeStatus
- Function:null A handler triggered for every phase of the swipe.
- Handler is passed 4 arguments
- event : The original event object
phase:The current swipe face, either "start", "move", "end" or "cancel".
direction : The swipe direction, either "up", "down", "left " or "right".
distance : The distance of the swipe.
- click
- Function:null A handler triggered when a user just clicks on the item, rather than swipes it. If they do not move, click is triggered, if they do move, it is not.
- Handler is passed 2 arguments
- event : The original event object
target : the HTML Dom object that was actually clicked on, this could be a child of the touchSwipe object.
fingers
int:1 The number of fingers to trigger the swipe, 1 or 2.
threshold
int:75 The number of pixels that the user must move their finger before it is considered a swipe.
triggerOnTouchEnd
Boolean:true If true, the swipe events are triggered when the touch end event is received (user releases finger). If false, it will be triggered on reaching the threshold.
allowPageScroll
String:"auto". How the browser handles page scrolls when the user is swiping on a touchSwipe object.- Possible values are:
- "auto" : all undfined swipes will cause the page to scroll in that direction.
"none" : the page will not scroll when user swipes.
"horizontal" : will force page to scroll on horizontal swipes.
"vertical" : will force page to scroll on vertical swipes.