-
Notifications
You must be signed in to change notification settings - Fork 32
/
index.html
149 lines (135 loc) · 3.13 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>slider test page</title>
<script src="dist/swiped.js"></script>
<meta name="viewport" content="initial-scale=1,user-scalable=no,minimum-scale=1,maximum-scale=1,width=device-width" />
<style>
body, html {
margin: 0;
padding: 0;
font-size: 20px;
font-family: Arial;
}
li, .foo {
height: 60px;
padding: 0 10px;
list-style: none;
line-height: 60px;
color: #fff;
margin: 0 0 2px;
}
ul {
margin: 0 0 10px;
padding: 0;
}
.list1 li {
background: #f58160;
}
.list2 li {
background: #f9b15e;
}
.list3 li {
background: #97d7e8;
}
.foo {
background: #b1d14f;
position: relative;
padding-left: 50px;
height: 150px;
}
.foo span {
position: absolute;
left: 15px;
top: 17px;
height: 15px;
width: 20px;
border-top: 3px solid #fff;
border-bottom: 3px solid #fff;
}
.foo span:after {
content: "";
border-top: 3px solid #fff;
top: 6px;
left: 0;
width: 100%;
position: absolute;
height: 1px;
}
p {
margin: 20px 10px;
}
.wrapper {
overflow: hidden;
padding: 10px;
}
</style>
</head>
<body>
<div class="wrapper">
<ul class="list1">
<li>
<span>← swipe to delete</span>
</li>
<li>
← swipe to delete
</li>
</ul>
<p>multiple:</p>
<ul class="list2">
<li>
element 2
</li>
<li>
element 3
</li>
</ul>
<p>multiple with dependence:</p>
<ul class="list3">
<li>
element 4
</li>
<li>
element 5
</li>
<li>
element 6
</li>
</ul>
<p>single element with switch:</p>
<div class="foo"><span></span>element 16</div>
</div>
<script>
var a1 = Swiped.init({
query: '.list1 li',
right: 400,
onOpen: function() {
this.destroy(true)
},
onClose: function() {
console.log('close')
}
});
var a2 = Swiped.init({
query: '.list2 li',
left: 200
});
var a3 = Swiped.init({
query: '.list3 li',
list: true,
left: 70,
right: 100
});
var a4 = Swiped.init({
query: '.foo',
left: 200
});
document.querySelector('.foo span').addEventListener('touchstart', function(e) {
a4.toggle();
e.stopPropagation();
e.preventDefault();
});
</script>
</body>
</html>