-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsortable.html
92 lines (89 loc) · 2.19 KB
/
sortable.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<style>
#sortable1,
#sortable2,
#sortable3 {
list-style-type: none;
margin: 0;
margin-right: 10px;
background: #eee;
padding: 5px;
/*width: 143px;*/
height: 50px;
margin-bottom: 100px;
}
#sortable1 li,
#sortable2 li,
#sortable3 li {
margin: 5px;
padding: 5px;
font-size: 1.2em;
width: 120px;
float: left;
}
.selector{
width: 100px;
height: 30px;
background-color: #666;
}
.display{
height: 80px;
display: none;
}
.display li{
height: 10px;
}
</style>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$( "ul.droptrue" ).sortable({
connectWith: "ul",
cursor: "move",
helper: 'clone'
});
$( "ul.dropfalse" ).sortable({
connectWith: "ul",
dropOnEmpty: false
});
$('.selector').sortable({
appendTo : document.body
});
$( "#sortable1, #sortable2, #sortable3" ).disableSelection();
$( "ul.droptrue li" ).on('click',function(){
$(this).find('.display').toggle();
})
} );
</script>
</head>
<body>
<ul id="sortable1" class="droptrue">
<li class="ui-state-default">Item 1</li>
<li class="ui-state-default">Item 2</li>
<li class="ui-state-default">Item 3</li>
<li class="ui-state-default">Item 4</li>
<li class="ui-state-default">
<span>Item 5</span>
<ul class="display">
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</li>
</ul>
<ul id="sortable2" class="dropfalse">
<li class="ui-state-highlight">Item 1</li>
<li class="ui-state-highlight">Item 2</li>
<li class="ui-state-highlight">Item 3</li>
<li class="ui-state-highlight">Item 4</li>
<li class="ui-state-highlight">Item 5</li>
</ul>
</body>
</html>