This repository has been archived by the owner on Apr 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathexample.html
135 lines (115 loc) · 2.47 KB
/
example.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
<!doctype html>
<html>
<head>
<meta charset='utf-8'>
<title>UI Sortable</title>
<script src='build/build.js'></script>
<style>
body {
padding: 80px;
font-family: 'Helvetica Neue';
font-weight: 200;
}
h2 {
font-weight: inherit;
}
ul {
list-style: none;
padding: 20px 20px;
width: 200px;
}
ul li {
display: block;
padding: 8px;
border-bottom: 1px solid #ddd;
height: 20px;
}
li span {
display: inline-block;
width: 12px;
height: 12px;
margin-right: 10px;
}
li span:before {
content: '❖';
}
.numbers {
height: 200px;
}
.numbers li {
float: left;
border: 1px solid #f0f0f0;
margin: 8px;
width: 20px;
height: 20px;
text-align: center;
}
[disabled] {
opacity: .5;
}
</style>
</head>
<body>
<h2>List</h2>
<ul class='languages'>
<li>Javascript</li>
<li>Lua</li>
<li>Google Go</li>
<li>Julia</li>
</ul>
<h2>Disabled items</h2>
<ul class='languages'>
<li>Javascript</li>
<li>Lua</li>
<li disabled>Google Go</li>
<li>Julia</li>
</ul>
<h2>Handle</h2>
<ul class='handle'>
<li><span></span>Javascript</li>
<li><span></span>Lua</li>
<li><span></span>Google Go</li>
<li><span></span>Julia</li>
</ul>
<h2>Grid</h2>
<ul class='numbers'>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
</ul>
<h2>Connected</h2>
<ul class='one'>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
<ul>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
<script>
var Sortable = require('sortable');
var els = document.querySelectorAll('.numbers, .languages, .handle');
var ul = document.querySelector('.one');
// all
[].slice.call(els).forEach(function(el){
var sortable = new Sortable(el);
if ('handle' == el.className) sortable.handle('span');
sortable.ignore('[disabled]');
sortable.bind();
});
// connected
var one = new Sortable(ul);
var two = new Sortable(ul.nextElementSibling);
// two <> one
two.bind()
.connect(one.bind())
.connect(two);
</script>
</body>
</html>