Latest web development tutorials

jQuery Mobile swipe event

jQuery Mobile Events jQuery Mobile Events

Examples

The element <p> horizontal sliding hide it:

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

try it"

Definition and Usage

swipe event drag 30px more in the horizontal direction will trigger the event, (the vertical direction is less than 75px).

Tip: You can swipe in either direction.

Related events:

  • swipeleft - Fires when the user left across the element exceeds 30px.
  • swiperight - Fires when the user right across the element exceeds 30px.

grammar

$("selector").on("swipe",function(event){...})

参数 描述
function(event) 必须。指定 swipe 事件触发时执行的函数。

该函数有可选的事件对象 ,事件对象可以是任何 jQuery 事件属性 (例如 event.target, event.type, 等)。更多信息请查阅 jQuery 事件参考手册


Examples

More examples

Event objects
Use event.target property to return the DOM element swipe event trigger.


jQuery Mobile Events jQuery Mobile Events