jQuery Mobile Touch 事件

Touch 事件在用戶觸摸屏幕(頁面)時觸發。

提示:Touch 事件同樣適用于桌面電腦:點擊鼠標!

jQuery Mobile Tap

tap 事件在用戶敲擊某個元素時觸發。

下面的例子當 <p> 元素上觸發 tap 事件時,隱藏當前 <p> 元素:

實例

$("p").on("tap",function(){
  $(this).hide();
});

親自試一試

jQuery Mobile Taphold

taphold 事件在用戶敲擊某個元素并保持一秒時被觸發:

實例

$("p").on("taphold",function(){
  $(this).hide();
});

親自試一試

jQuery Mobile Swipe

swipe 事件在用戶在某個元素上水平滑動超過 30px 時被觸發:

實例

$("p").on("swipe",function(){
  $("span").text("Swipe detected!");
});

親自試一試

jQuery Mobile Swipeleft

swipeleft 事件在用戶在某個元素上從左滑動超過 30px 時被觸發:

實例

$("p").on("swipeleft",function(){
  alert("You swiped left!");
});

親自試一試

jQuery Mobile Swiperight

swiperight 事件在用戶在某個元素上從右滑動超過 30px 時被觸發:

實例

$("p").on("swiperight",function(){
  alert("You swiped right!");
});

親自試一試