ionic 手勢事件
事件 | 描述 | 用法 | 例項 |
---|---|---|---|
on-hold | 長按的時間是500毫秒。 | <button on-hold="onHold()" class="button"> Test </button> |
嘗試一下 ? |
on-tap | 這個是手勢輕擊事件,如果長按時間超過250毫秒,那就不是輕擊了。。 | <button on-tap="onTap()" class="button"> Test </button> |
嘗試一下 ? |
on-double-tap | 手雙擊螢幕事件 | <button on-double-tap="onDoubleTap()" class="button"> Test </button> |
嘗試一下 ? |
on-touch | 這個和 on-tap 還是有區別的,這個是立即執行,而且是使用者點選立馬執行。不用等待 touchend/mouseup 。 | <button on-touch="onTouch()" class="button"> Test </button> |
嘗試一下 ? |
on-release | 當用戶結束觸控事件時觸發。 | <button on-release="onRelease()" class="button"> Test </button> |
嘗試一下 ? |
on-drag | 這個有點類似於PC端的拖拽。當你一直點選某個物體,並且手開始移動,都會觸發 on-drag。 | <button on-drag="onDrag()" class="button"> Test </button> |
嘗試一下 ? |
on-drag-up | 向上拖拽。 | <button on-drag-up="onDragUp()" class="button"> Test </button> |
嘗試一下 ? |
on-drag-right | 向右拖拽。 | <button on-drag-right="onDragRight()" class="button"> Test </button> |
嘗試一下 ? |
on-drag-down | 向下拖拽。 | <button on-drag-down="onDragDown()" class="button"> Test </button> |
嘗試一下 ? |
on-drag-left | 向左邊拖拽。 | <button on-drag-left="onDragLeft()" class="button"> Test </button> |
嘗試一下 ? |
on-swipe | 指手指滑動效果,可以是任何方向上的。而且也和 on-drag 類似,都有四個方向上單獨的事件。 | <button on-swipe="onSwipe()" class="button"> Test </button> |
嘗試一下 ? |
on-swipe-up | 向上的手指滑動效果。 | <button on-swipe-up="onSwipeUp()" class="button"> Test </button> |
嘗試一下 ? |
on-swipe-right | 向右的手指滑動效果。 | <button on-swipe-right="onSwipeRight()" class="button"> Test </button> |
嘗試一下 ? |
on-swipe-down | 向下的手指滑動效果。 | <button on-swipe-down="onSwipeDown()" class="button"> Test </button> |
嘗試一下 ? |
on-swipe-left | 向左的手指滑動效果。 | <button on-swipe-left="onSwipeLeft()" class="button"> Test </button> |
嘗試一下 ? |
$ionicGesture
一個angular服務展示ionicionic.EventController手勢。
方法
on(eventType, callback, $element)
在一個元素上新增一個事件監聽器。
引數 | 型別 | 詳情 |
---|---|---|
eventType |
string
|
監聽的手勢事件。 |
callback |
function(e)
|
當手勢事件發生時觸發的事件。 |
$element |
element
|
angular元素監聽的事件。 |
options |
object
|
物件。 |
off(eventType, callback, $element)
在一個元素上移除一個手勢事件監聽器。
引數 | 型別 | 詳情 |
---|---|---|
eventType |
string
|
移除監聽的手勢事件。 |
callback |
function(e)
|
移除監聽器。 |
$element |
element
|
被監聽事件的angular元素。 |