2017-04-21 98 views
0

我目前使用以下jQuery的事件:觸發jQuery的「tapout」事件

$('.owl-item').on("taphold",function(){ 
    // Do something 
} 

所以基本上時與班上.owl-item一個元素被挖掘並舉行了它會觸發該事件。

當用戶停止點擊握住,例如移動設備上的手指不再放在.owl-item元素上時,我想觸發另一個事件。

我只是想知道是否有任何其他事件可以告知taphold事件不再發生並已結束?

像這樣:

$('.owl-item').on("tapout",function(){ 
    // The element is no longer being held 
} 
+0

'mousedown' =>標記時間開始,'mouseup' =>標記時間結束=>如果大於閾值=>'taphold'。映射鼠標事件來觸摸事件或使用一些插件 – Justinas

回答

0

沒有的jQuery tapout事件。

請嘗試在touchend下編寫您所需的代碼。

$('.owl-item').on('touchend', function(event, ui) { 
    console.log('Triggered touchend Event: '+event.type); 
});