blob: fe1f17d05419c30383cb15e2d65b913e7408c7d6 (
plain)
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
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Language" content="en" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sortable Demo</title>
<script src="../jquery-1.2.3.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../jquery.dimensions.js"></script>
<script type="text/javascript" src="../ui.mouse.js"></script>
<script type="text/javascript" src="../ui.sortable.js"></script>
<script type="text/javascript" src="../ui.sortable.ext.js"></script>
<style type="text/css">
body,html {
margin: 0;
padding: 0;
}
#container {
width: 100%;
z-index: 1;
}
.width33 .box { width: 33%; }
.width25 .box { width: 25%; }
.width20 .box { width: 20%; }
.hover { background: #fff; border: 1px dotted #333; }
.box {
height: 100px;
float: left;
}
.inner {
border: 1px solid black;
margin: 10px;
height: 80px;
background: #ddd;
}
.footer {
position: fixed;
z-index: 1000;
bottom: 0px;
left: 0px;
width: 100%;
height: 30px;
background: #333;
}
</style>
</head>
<body>
<div id='container'>
<div class="box">
<div class='inner'>
<p>Box 1<p>
</div>
</div>
<div class="box">
<div class='inner'>
Box 2
</div>
</div>
<div class="box">
<div class='inner'>
Box 3
</div>
</div>
<div class="box">
<div class='inner'>
Box 4
</div>
</div>
<div class="box">
<div class='inner'>
Box 5
</div>
</div>
<div class="box">
<div class='inner'>
Box 6
</div>
</div>
<div class="box">
<div class='inner'>
Box 7
</div>
</div>
<div class="box">
<div class='inner'>
Box 8
</div>
</div>
<div class="box">
<div class='inner'>
Box 9
</div>
</div>
<div class="box">
<div class='inner'>
Box 10
</div>
</div>
</div>
<div class='footer'>
<button onclick="$('#container').removeClass().addClass('width33');">33%</button>
<button onclick="$('#container').removeClass().addClass('width25');">25%</button>
<button onclick="$('#container').removeClass().addClass('width20');">20%</button>
<button onclick="addItems(100);">Add 100 items</button>
<div>
<script type="text/javascript">
function addItems(e) {
for (var i = e - 1; i >= 0; i--){
$('#container').append('<div class="box"><div class="inner">'+i+'</div></div>');
};
}
$(window).bind("load",function(){
$("#container").sortable({
handle: 'p',
revert: true,
scroll: true,
placeholder: 'hover', //the class te placeholder should have
placeholderElement: '> div' //Due to IE's shitty rendering, we'll use a div/div combination to handle percentages with margins - now we want to use the contrains from the inner div of course
});
});
</script>
</body>
</html>
|