All samples are using
Ink.requireModules, please read how to use it at Ink.requireModules section
Subscribe swipe gestures.
Supports filtering swipes be any combination of the criteria supported in the options.
onEnd options receive as argument an object containing:
event: the DOMEvent object
element: the target element
[x, y]coordinates of current position
dt: Time passed between now and the first event (onMove only)
gesture: an Array containing [x,y] coordinates of every touchmove event received (only if options.storeGesture is enabled) (onEnd only)
time: an Array containing all the
dtvalues for every touchmove event (onEnd only)
overallMovement: X and Y distance traveled by the touch movement (
[x, y]) (onEnd only)
overallTime: total time passed (onEnd only)
|new Swipe(el, options)||Constructor|
elElement or Selector
options.onEndCallback function for the `touchend` event. Gets all the gesture information, and is filtered by min/max Dist and Duration options (see below)
options.onStartCallback function for `touchstart` event.
options.onMoveCallback function for every `touchmove` event. Gets current gesture information.
options.minDistMinimum allowed distance, in pixels.
options.maxDistMaximum allowed distance, in pixels.
options.minDurationMinimum allowed duration, in seconds.
options.maxDurationMaximum allowed duration, in seconds.
options.axisIf either 'x' or 'y' is passed, only swipes where the dominant axis is the given one trigger the callback
options.storeGestureIf to store gesture information and provide it to the callback. Defaults to true.
options.stopEventsFlag to stop (default and propagation) of the received events. Defaults to true.