-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
77 lines (50 loc) · 1.38 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
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
.list > div {
min-height: 50px;
border-style: solid;
border-width: 2px;
text-align: center;
line-height: 50px;
font-size: 20px;
font-family: Helvetica;
}
.half {
display: inline-block;
width: 49%;
padding: 0;
margin: 0;
vertical-align: top;
}
</style>
</head>
<body>
<div id="Demo" class="list-group col nsortable">
<div class="list half list-group-item nested-1" id="list1" style="background: pink;">
<div data-sortable-id="1.1" id="1.1">Item 1.1</div>
<div data-sortable-id="1.2" id="1.2">Item 1.2</div>
<div data-sortable-id="1.5" id="1.5">Item 1.5</div>
</div>
<div class="list half list-group-item nested-2" id="list2">
<div data-sortable-id="2.1" id="1.5" dataid="2.1">Item 2.1</div>
<div data-sortable-id="2.2" dataid="2.2">Item 2.2</div>
</div>
</div>
<p id="log"></p>
<script src="Sortable.js"></script>
<script type="text/javascript">
let opt = {
group: 'shared',
animation:150,
/*onStart: (evt) => {console.log(evt.oldIndex)},*/
onEnd: (evt) => {console.log(evt.item.id, evt.item.getAttribute('dataid'), evt.to.id)}
}
//var sortable = Sortable.create(el, options);
new Sortable.create(document.getElementById('list1'), opt);
new Sortable.create(document.getElementById('list2'), opt);
</script>
</body>
</html>