Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

ionic Gesture Events

ionic Gesture Events

Events Description Usage Example
on-hold The long-press duration is 500 milliseconds.

| Try it » | | on-tap | This is a tap gesture event; if the long-press exceeds 250 milliseconds, it is not a tap. |

| Try it » | | on-double-tap | Double-tap on the screen event |
| Try it » | | on-touch | This is different from on-tap; it executes immediately when the user taps, without waiting for touchend/mouseup. |
    
| Try it » | | on-release | Triggered when the user ends the touch event. |
| Try it » | | on-drag | This is somewhat like dragging on a PC. When you keep pressing an object and start moving your hand, on-drag is triggered. |
| Try it » | | on-drag-up | Drag upward. |


| Try it » | | on-drag-right | Drag to the right. |
| Try it » | | on-drag-down | Drag downward. |
| Try it » | | on-drag-left | Drag to the left. |
| Try it » | | on-swipe | Refers to a finger swipe, which can be in any direction. Like on-drag, it also has separate events for four directions. |
| Try it » | | on-swipe-up | Upward finger swipe. |
| Try it » | | on-swipe-right | Rightward finger swipe. |
| Try it » | | on-swipe-down | Downward finger swipe. |
| Try it » | | on-swipe-left | Leftward finger swipe. |
| Try it » |


$ionicGesture

An angular service that exposes ionic gestures via ionic.EventController.

Method



on(eventType, callback, $element)

Add an event listener on an element.

Parameters Type Details
eventType string

The gesture event to listen for.

callback function(e)

The event triggered when the gesture event occurs.

$element element

The angular element that listens for the event.

options object

object.



off(eventType, callback, $element)

Remove a gesture event listener from an element.

Parameters Type Details
eventType string

The gesture event to stop listening for.

callback function(e)

Remove the listener.

$element element

The angular element whose event is being listened to.