forked from yields/sortable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
101 lines (86 loc) · 1.75 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
<!doctype html>
<html>
<head>
<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;
}
.numbers {
height: 200px;
}
.numbers li {
float: left;
border: 1px solid #f0f0f0;
margin: 8px;
width: 20px;
height: 20px;
text-align: center;
}
</style>
</head>
<body>
<h2>List</h2>
<ul class='languages'>
<li>Javascript</li>
<li>Lua</li>
<li>Google Go</li>
<li>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');
var ul = document.querySelector('.one');
// all
[].slice.call(els).forEach(function(el){
var sortable = new Sortable(el);
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>