swipe

$.fn. swipe

new swipe(method)

Source:
See:
  • TouchSwipe
Applies TouchSwipe behaviour to one or more jQuery objects. The TouchSwipe plugin can be instantiated via this method, or methods within TouchSwipe can be executed via this method as per jQuery plugin architecture. An existing plugin can have its options changed simply by re calling .swipe(options)
Parameters:
Name Type Description
method Mixed If the current DOMNode is a TouchSwipe object, and method is a TouchSwipe method, then the method is executed, and any following arguments are passed to the TouchSwipe method. If method is an object, then the TouchSwipe class is instantiated on the current DOMNode, passing the configuration properties defined in the object. See TouchSwipe

Namespaces

defaults
directions
fingers
pageScroll
phases

Members

(static, readonly) version

Source:
The version of the plugin

Methods

destroy()

Source:
Destroy the swipe plugin completely. To use any swipe methods, you must re initialise the plugin.
Example
$("#element").swipe("destroy");

disable() → {DOMNode}

Source:
disables the swipe plugin
Example
$("#element").swipe("disable");
Returns:
The Dom element that is now registered with TouchSwipe
Type
DOMNode

enable() → {DOMNode}

Source:
re-enables the swipe plugin with the previous configuration
Example
$("#element").swipe("enable");
Returns:
The Dom element that was registered with TouchSwipe
Type
DOMNode

option(property, valueopt) → {Object}

Source:
See:
Allows run time updating of the swipe configuration options.
Examples
$("#element").swipe("option", "threshold"); // return the threshold
$("#element").swipe("option", "threshold", 100); // set the threshold after init
$("#element").swipe("option", {threshold:100, fingers:3} ); // set multiple properties after init
$("#element").swipe({threshold:100, fingers:3} ); // set multiple properties after init - the "option" method is optional!
$("#element").swipe("option"); // Return the current options hash
Parameters:
Name Type Attributes Description
property String The option property to get or set, or a has of multiple options to set
value Object <optional>
The value to set the property to
Returns:
If only a property name is passed, then that property value is returned. If nothing is passed the current options hash is returned.
Type
Object

Events

click

Source:
Deprecated:
  • since version 1.6.2, please use $.fn.swipe#tap instead
Default Value:
  • null
A click handler triggered when a user simply clicks, rather than swipes on an element. This is deprecated since version 1.6.2, any assignment to click will be assigned to the tap handler. You cannot use on to bind to this event as the default jQ click event will be triggered. Use the tap event instead.
Parameters:
Name Type Description
event EventObject The original event object
target DomObject The element clicked on.

doubleTap

Source:
Default Value:
  • null
See:
  • $.fn.swipe.defaults#doubleTapThreshold
A double tap handler triggered when a user double clicks or taps on an element. You can set the time delay for a double tap with the $.fn.swipe.defaults#doubleTapThreshold property. Note: If you set both doubleTap and tap handlers, the tap event will be delayed by the doubleTapThreshold as the script needs to check if its a double tap.
Parameters:
Name Type Description
event EventObject The original event object
target DomObject The element clicked on.

hold

Source:
Default Value:
  • null
See:
  • $.fn.swipe.defaults#longTapThreshold
A hold tap handler triggered as soon as the longTapThreshold is reached You can set the time delay for a long tap with the $.fn.swipe.defaults#longTapThreshold property.
Parameters:
Name Type Description
event EventObject The original event object
target DomObject The element clicked on.

longTap

Source:
Default Value:
  • null
See:
  • $.fn.swipe.defaults#longTapThreshold
A long tap handler triggered once a tap has been release if the tap was longer than the longTapThreshold. You can set the time delay for a long tap with the $.fn.swipe.defaults#longTapThreshold property.
Parameters:
Name Type Description
event EventObject The original event object
target DomObject The element clicked on.

pinchIn

Source:
Default Value:
  • null
A handler triggered for pinch in events.
Parameters:
Name Type Description
event EventObject The original event object
direction int The direction the user pinched in. See $.fn.swipe.directions
distance int The distance the user pinched
duration int The duration of the swipe in milliseconds
fingerCount int The number of fingers used. See $.fn.swipe.fingers
zoom int The zoom/scale level the user pinched too, 0-1.
fingerData object The coordinates of fingers in event

pinchOut

Source:
Default Value:
  • null
A handler triggered for pinch out events.
Parameters:
Name Type Description
event EventObject The original event object
direction int The direction the user pinched in. See $.fn.swipe.directions
distance int The distance the user pinched
duration int The duration of the swipe in milliseconds
fingerCount int The number of fingers used. See $.fn.swipe.fingers
zoom int The zoom/scale level the user pinched too, 0-1.
fingerData object The coordinates of fingers in event

pinchStatus

Source:
Default Value:
  • null
A handler triggered for all pinch events. This handler is constantly fired for the duration of the pinch. This is triggered regardless of thresholds.
Parameters:
Name Type Description
event EventObject The original event object
direction int The direction the user pinched in. See $.fn.swipe.directions
distance int The distance the user pinched
duration int The duration of the swipe in milliseconds
fingerCount int The number of fingers used. See $.fn.swipe.fingers
zoom int The zoom/scale level the user pinched too, 0-1.
fingerData object The coordinates of fingers in event

swipe

Source:
Default Value:
  • null
A catch all handler that is triggered for all swipe directions.
Parameters:
Name Type Description
event EventObject The original event object
direction int The direction the user swiped in. See $.fn.swipe.directions
distance int The distance the user swiped
duration int The duration of the swipe in milliseconds
fingerCount int The number of fingers used. See $.fn.swipe.fingers
fingerData object The coordinates of fingers in event
currentDirection string The current direction the user is swiping.

swipeDown

Source:
Default Value:
  • null
A handler that is triggered for "down" swipes.
Parameters:
Name Type Description
event EventObject The original event object
direction int The direction the user swiped in. See $.fn.swipe.directions
distance int The distance the user swiped
duration int The duration of the swipe in milliseconds
fingerCount int The number of fingers used. See $.fn.swipe.fingers
fingerData object The coordinates of fingers in event
currentDirection string The current direction the user is swiping.

swipeLeft

Source:
Default Value:
  • null
A handler that is triggered for "left" swipes.
Parameters:
Name Type Description
event EventObject The original event object
direction int The direction the user swiped in. See $.fn.swipe.directions
distance int The distance the user swiped
duration int The duration of the swipe in milliseconds
fingerCount int The number of fingers used. See $.fn.swipe.fingers
fingerData object The coordinates of fingers in event
currentDirection string The current direction the user is swiping.

swipeRight

Source:
Default Value:
  • null
A handler that is triggered for "right" swipes.
Parameters:
Name Type Description
event EventObject The original event object
direction int The direction the user swiped in. See $.fn.swipe.directions
distance int The distance the user swiped
duration int The duration of the swipe in milliseconds
fingerCount int The number of fingers used. See $.fn.swipe.fingers
fingerData object The coordinates of fingers in event
currentDirection string The current direction the user is swiping.

swipeStatus

Source:
Default Value:
  • null
A handler triggered for every phase of the swipe. This handler is constantly fired for the duration of the pinch. This is triggered regardless of swipe thresholds.
Parameters:
Name Type Description
event EventObject The original event object
phase string The phase of the swipe event. See $.fn.swipe.phases
direction string The direction the user swiped in. This is null if the user has yet to move. See $.fn.swipe.directions
distance int The distance the user swiped. This is 0 if the user has yet to move.
duration int The duration of the swipe in milliseconds
fingerCount int The number of fingers used. See $.fn.swipe.fingers
fingerData object The coordinates of fingers in event
currentDirection string The current direction the user is swiping.

swipeUp

Source:
Default Value:
  • null
A handler that is triggered for "up" swipes.
Parameters:
Name Type Description
event EventObject The original event object
direction int The direction the user swiped in. See $.fn.swipe.directions
distance int The distance the user swiped
duration int The duration of the swipe in milliseconds
fingerCount int The number of fingers used. See $.fn.swipe.fingers
fingerData object The coordinates of fingers in event
currentDirection string The current direction the user is swiping.

tap

Source:
Default Value:
  • null
A click / tap handler triggered when a user simply clicks or taps, rather than swipes on an element.
Parameters:
Name Type Description
event EventObject The original event object
target DomObject The element clicked on.