This repository has been archived by the owner on May 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
index.html
64 lines (55 loc) · 2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Swipe to Delete</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<link rel="stylesheet" href="src/jquery.swipeButton.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<script src="dist/jquery.swipeButton-1.2.1.min.js"></script>
<script>
$(document).ready(function() {
// attach the plugin to an element
$('#swipeMe li').swipeDelete({
btnTheme: 'e',
btnLabel: 'Delete',
btnClass: 'aSwipeButton',
click: function(e){
e.preventDefault();
var url = $(e.target).attr('href');
$(this).parents('li').slideUp();
$.post(url, function(data) {
console.log(data);
});
}
});
$('#triggerMe').on('click', function(){
$('#swipeMe li:nth-child(3)').trigger('swiperight')
});
});
</script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>swipeButton</h1>
</div>
<div data-role="content">
<ul id="swipeMe" data-role="listview">
<li data-swipeurl="swiped.html?1"><a href="row-click.html">List Item One</a></li>
<li data-swipeurl="swiped.html?2"><a href="row-click.html">List Item Two</a></li>
<li data-swipeurl="swiped.html?3"><a href="row-click.html">List Item Three</a></li>
<li data-role="list-divider">Divider One</li>
<li data-swipeurl="swiped.html?4"><a href="row-click.html">List Item Four</a></li>
</ul><br />
<!-- uncomment the following code to trigger the swipe event from a desktop browser -->
<br /><br />
<a href="#" data-role="button" id="triggerMe">trigger swipe right</a>
<p align="center">Swipe to the right on any list item to display the button</p>
<a href="https://github.com/commadelimited/jquery.swipeButton.js" data-role="button">Get the code</a>
</div>
</div>
</body>
</html>