jQuery Mobile Touch events

Touch events are triggered when the user touches the screen (page).

Tip:Touch events also apply to desktop computers: click the mouse!

jQuery Mobile Tap

Tap event is triggered when the user taps an element.

The following example hides the current <p> element when the tap event is triggered on the <p> element:

مثال

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

آزمایش کنید

jQuery Mobile Taphold

taphold 事件 when the user taps on an element and holds for one second is triggered:

مثال

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

آزمایش کنید

jQuery Mobile Swipe

swipe 事件 when the user horizontally slides on an element more than 30px is triggered:

مثال

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

آزمایش کنید

jQuery Mobile Swipeleft

swipeleft 事件 when the user slides from left on an element more than 30px is triggered:

مثال

$("p").on("swipeleft",function(){
  alert("شما به سمت چپ کشیدید!");
});

آزمایش کنید

جی کوئری موبایل Swiperight

رویداد swiperight هنگامی که کاربر از 30px به سمت راست در یک عنصر می‌کشد، فعال می‌شود:

مثال

$("p").on("swiperight",function(){
  alert("شما به سمت راست کشیدید!");
});

آزمایش کنید