$ons.GestureDetector

Utility class for gesture detection.

Signature Description
constructor(element[, options]) Create a new GestureDetector instance.
on(gestures, handler) Adds an event handler for a gesture. Available gestures are: drag, dragleft, dragright, dragup, dragdown, hold, release, swipe, swipeleft, swiperight, swipeup, swipedown, tap, doubletap, touch, transform, pinch, pinchin, pinchout and rotate.
off(gestures, handler) Remove an event listener.
trigger(gesture, eventData)
enable(state) Enable or disable gesture detection.
dispose() Remove and destroy all event handlers for this instance.
constructor(element[, options]): ons.GestureDetector.Instance

Create a new GestureDetector instance.

Parameters
Name Type Description
element Element Name of the event.
options Object Options object.
on(gestures, handler)

Adds an event handler for a gesture. Available gestures are: drag, dragleft, dragright, dragup, dragdown, hold, release, swipe, swipeleft, swiperight, swipeup, swipedown, tap, doubletap, touch, transform, pinch, pinchin, pinchout and rotate.

Parameters
Name Type Description
gestures String A space separated list of gestures.
handler Function An event handling function.
off(gestures, handler)

Remove an event listener.

Parameters
Name Type Description
gestures String A space separated list of gestures.
handler Function An event handling function.
trigger(gesture, eventData)

Parameters
Name Type Description
gesture String
eventData Object
enable(state)

Enable or disable gesture detection.

Parameters
Name Type Description
state Boolean Specify if it should be enabled or not.
dispose()

Remove and destroy all event handlers for this instance.

Name Description
drag
dragstart
dragend
drapleft
dragright
dragup
dragdown
gesture
hold
release
swipe
swipeleft
swiperight
swipeup
swipedown
tap
doubletap
touch
transform
transformstart
transformend
pinchin
pinchout
rotate
drag

Parameters
Name Type Description
ev Object
dragstart

Parameters
Name Type Description
ev Object
dragend

Parameters
Name Type Description
ev Object
drapleft

Parameters
Name Type Description
ev Object
dragright

Parameters
Name Type Description
ev Object
dragup

Parameters
Name Type Description
ev Object
dragdown

Parameters
Name Type Description
ev Object
gesture

Parameters
Name Type Description
ev Object
hold

Parameters
Name Type Description
ev Object
release

Parameters
Name Type Description
ev Object
swipe

Parameters
Name Type Description
ev Object
swipeleft

Parameters
Name Type Description
ev Object
swiperight

Parameters
Name Type Description
ev Object
swipeup

Parameters
Name Type Description
ev Object
swipedown

Parameters
Name Type Description
ev Object
tap

Parameters
Name Type Description
ev Object
doubletap

Parameters
Name Type Description
ev Object
touch

Parameters
Name Type Description
ev Object
transform

Parameters
Name Type Description
ev Object
transformstart

Parameters
Name Type Description
ev Object
transformend

Parameters
Name Type Description
ev Object
pinchin

Parameters
Name Type Description
ev Object
pinchout

Parameters
Name Type Description
ev Object
rotate

Parameters
Name Type Description
ev Object

Need Help?

If you have any questions, use our Community Forum or talk to us on Discord chat. The Onsen UI team and your peers in the community will work together to help solve your issues.

For bug reports and feature requests use our GitHub Issues page.