Handle swipe right event
Description
The following code shows how to handle swipe right event.
Example
<!-- w w w .jav a 2 s.com-->
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.6.1.js'></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css">
<script type='text/javascript'
src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>
<style type='text/css'>
.add-border {
border-style: solid;
border-width: 1px;
width: 100%;
text-align: center;
}
</style>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
function bindEvent(element) {
element.bind('tap taphold swipe swiperight swipeleft', function(event, ui) {
alert('Event: '+event.type);
});
}
bindEvent($('#display-event'));
});//]]>
</script>
</head>
<body>
<div data-role="page" id="home">
<div data-role="content">
<div id="display-event" class="add-border">
<p>Tap, TapHold (for 1 second), Swipe, SwipeRight or SwipeLeft</p>
</div>
</div>
</div>
</body>
</html>