1 |
<!doctype html> |
2 |
<html lang="en"> |
3 |
<head> |
4 |
<meta charset="utf-8"> |
5 |
<title>jQuery UI Sortable - Drop placeholder</title> |
6 |
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css"> |
7 |
<script src="../../jquery-1.9.1.js"></script> |
8 |
<script src="../../ui/jquery.ui.core.js"></script> |
9 |
<script src="../../ui/jquery.ui.widget.js"></script> |
10 |
<script src="../../ui/jquery.ui.mouse.js"></script> |
11 |
<script src="../../ui/jquery.ui.sortable.js"></script> |
12 |
<link rel="stylesheet" href="../demos.css"> |
13 |
<style> |
14 |
#sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; } |
15 |
#sortable li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; height: 1.5em; } |
16 |
html>body #sortable li { height: 1.5em; line-height: 1.2em; } |
17 |
.ui-state-highlight { height: 1.5em; line-height: 1.2em; } |
18 |
</style> |
19 |
<script> |
20 |
$(function() { |
21 |
$( "#sortable" ).sortable({ |
22 |
placeholder: "ui-state-highlight" |
23 |
}); |
24 |
$( "#sortable" ).disableSelection(); |
25 |
}); |
26 |
</script> |
27 |
</head> |
28 |
<body> |
29 |
|
30 |
<ul id="sortable"> |
31 |
<li class="ui-state-default">Item 1</li> |
32 |
<li class="ui-state-default">Item 2</li> |
33 |
<li class="ui-state-default">Item 3</li> |
34 |
<li class="ui-state-default">Item 4</li> |
35 |
<li class="ui-state-default">Item 5</li> |
36 |
<li class="ui-state-default">Item 6</li> |
37 |
<li class="ui-state-default">Item 7</li> |
38 |
</ul> |
39 |
|
40 |
<div class="demo-description"> |
41 |
<p> |
42 |
When dragging a sortable item to a new location, other items will make room |
43 |
for the that item by shifting to allow white space between them. Pass a |
44 |
class into the <code>placeholder</code> option to style that space to |
45 |
be visible. Use the boolean <code>forcePlaceholderSize</code> option |
46 |
to set dimensions on the placeholder. |
47 |
</p> |
48 |
</div> |
49 |
</body> |
50 |
</html> |