jQuery Mobile swipe event
Example
On an element
swipe horizontally to hide it:
$("p").on("swipe",function(){
$(this).hide();
});
Try it »
Definition and Usage
The swipe event is triggered when dragging more than 30px horizontally (less than 75px vertically).
Tip: You can swipe quickly in both left and right directions.
Related events:
- swipeleft - Triggered when a user swipes across an element from the left by more than 30px.
- swiperight - Triggered when a user swipes across an element from the right by more than 30px.
Syntax
$("
selector
").on("swipe",function(event){...})
| Parameters | Description |
|---|---|
| function(event) | Required. Specifies the function to execute when the swipe event is triggered. |
该函数有可选的事件对象 ,事件对象可以是任何 jQuery 事件属性 (例如 event.target, event.type, 等)。更多信息请查阅 [jQuery 事件参考手册](/jquery/jquery-ref-events.html) 。 |
More examples
Event Object
Use the event.target property to return the DOM element that triggered the swipe event.
jQuery Mobile Events