demos/sortable: some cleanup and consistency

This commit is contained in:
Richard Worth 2009-01-20 13:12:22 +00:00
parent 670d3e0ac9
commit d578a66d49
17 changed files with 105 additions and 511 deletions

View File

@ -8,8 +8,8 @@
<script type="text/javascript" src="../../ui/ui.sortable.js"></script> <script type="text/javascript" src="../../ui/ui.sortable.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" /> <link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css"> <style type="text/css">
.demo ul { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; } #sortable1, #sortable2 { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; }
.demo li { margin: 5px; padding: 5px; font-size: 1.2em; width: 120px; } #sortable1 li, #sortable2 li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; width: 120px; }
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
@ -42,7 +42,12 @@
<div class="demo-description"> <div class="demo-description">
<p>Sort items from one list into another and vice versa passing an array into the <strong>connectWith</strong> option. The simplest way to do this is to group all related lists with a CSS class, and then pass that class into the sortable function using array notation (i.e., connectWith: ['.myclass']).</p> <p>
Sort items from one list into another and vice versa, by passing an array into
the <code>connectWith</code> option. The simplest way to do this is to
group all related lists with a CSS class, and then pass that class into the
sortable function using array notation (i.e., <code>connectWith: ['.myclass']</code>).
</p>
</div><!-- End demo-description --> </div><!-- End demo-description -->

View File

@ -1,52 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Sortable - Connecting Two Lists Demo</title>
<link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.3.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.sortable.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css">
.demo ul { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; }
.demo li { margin: 5px; padding: 5px; font-size: 1.2em; width: 120px; }
</style>
<script type="text/javascript">
$(function() {
$("#sortable1, #sortable2").sortable({
connectWith: ['.connectedSortable']
});
});
</script>
</head>
<body>
<div class="demo">
<ul id="sortable1" class="connectedSortable">
<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">Item 5</li>
</ul>
<ul id="sortable2" class="connectedSortable">
<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>
</div><!-- End demo -->
<div class="demo-description">
<p>
</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -9,7 +9,7 @@
<link type="text/css" href="../demos.css" rel="stylesheet" /> <link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css"> <style type="text/css">
#sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; } #sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
#sortable li { margin: 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; height: 18px; } #sortable li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; height: 18px; }
#sortable li span { position: absolute; margin-left: -1.3em; } #sortable li span { position: absolute; margin-left: -1.3em; }
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
@ -35,7 +35,11 @@
<div class="demo-description"> <div class="demo-description">
<p>Enable a group of DOM elements to be sortable. Click on and drag and element to a new spot within the list, and the other items will adjust to fit. By default, sortable items share <strong>draggable</strong> properties.</p> <p>
Enable a group of DOM elements to be sortable. Click on and drag an
element to a new spot within the list, and the other items will adjust to
fit. By default, sortable items share <strong>draggable</strong> properties.
</p>
</div><!-- End demo-description --> </div><!-- End demo-description -->

View File

@ -8,34 +8,36 @@
<script type="text/javascript" src="../../ui/ui.sortable.js"></script> <script type="text/javascript" src="../../ui/ui.sortable.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" /> <link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css"> <style type="text/css">
.demo ul { list-style-type: none; margin: 0; padding: 0; margin-bottom: 15px; } #sortable1, #sortable2 { list-style-type: none; margin: 0; padding: 0; margin-bottom: 15px; }
.demo li { margin: 5px; padding: 5px; font-size: 1.2em; } #sortable1 li, #sortable2 li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; }
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$("#sortable").sortable({ $("#sortable1").sortable({
delay: 1000 delay: 300
}); });
$("#sortable2").sortable({ $("#sortable2").sortable({
distance: 50 distance: 15
}); });
$("li").disableSelection();
}); });
</script> </script>
</head> </head>
<body> <body>
<div class="demo"> <div class="demo">
<h3 class="docs">Time delay of 1000ms:</h3> <h3 class="docs">Time delay of 300ms:</h3>
<ul id="sortable"> <ul id="sortable1">
<li class="ui-state-default">Item 1</li> <li class="ui-state-default">Item 1</li>
<li class="ui-state-default">Item 2</li> <li class="ui-state-default">Item 2</li>
<li class="ui-state-default">Item 3</li> <li class="ui-state-default">Item 3</li>
<li class="ui-state-default">Item 4</li> <li class="ui-state-default">Item 4</li>
</ul> </ul>
<h3>Distance delay of 50px:</h3> <h3 class="docs">Distance delay of 15px:</h3>
<ul id="sortable2"> <ul id="sortable2">
<li class="ui-state-default">Item 1</li> <li class="ui-state-default">Item 1</li>
@ -48,7 +50,13 @@
<div class="demo-description"> <div class="demo-description">
<p>Delay the start of sorting for a number of milliseconds with the <strong>delay</strong> option; prevent sorting until the cursor is held down and dragged a specifed number of pixels with the <strong>distance</strong> option. </p> <p>
Prevent accidental sorting either by delay (time) or distance. Set a number of
milliseconds the element needs to be dragged before sorting starts
with the <code>delay</code> option. Set a distance in pixels the element
needs to be dragged before sorting starts with the <code>distance</code>
option.
</p>
</div><!-- End demo-description --> </div><!-- End demo-description -->

View File

@ -1,46 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Sortable - Delay / Distance Demo</title>
<link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.3.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.sortable.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css">
.demo ul { list-style-type: none; margin: 0; padding: 0; margin-bottom: 15px; }
.demo li { margin: 5px; padding: 5px; font-size: 1.2em; }
</style>
<script type="text/javascript">
$(function() {
$("#sortable").sortable({
delay: 1000
});
});
</script>
</head>
<body>
<div class="demo">
<p>Delay of 1000ms</p>
<ul id="sortable">
<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">Item 5</li>
</ul>
</div><!-- End demo -->
<div class="demo-description">
<p>
</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -39,7 +39,10 @@
<div class="demo-description"> <div class="demo-description">
<p>To arrange sortable items as a grid, give them identical dimensions and float them using CSS.</p> <p>
To arrange sortable items as a grid, give them identical dimensions and
float them using CSS.
</p>
</div><!-- End demo-description --> </div><!-- End demo-description -->

View File

@ -1,88 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Sortable - Display as portlets</title>
<link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.3.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.sortable.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css">
.column { width: 170px; float: left; padding-bottom: 100px; }
.portlet { margin: 1em; }
.portlet-header { margin: 0.3em; padding-left: 0.2em; }
.portlet-header .ui-icon { float: right; }
.portlet-content { padding: 0.4em; }
.ui-sortable-placeholder { border: 1px dotted black; visibility: visible !important; }
.ui-sortable-placeholder * { visibility: hidden; }
</style>
<script type="text/javascript">
$(function() {
$(".column").sortable({
connectWith: ['.column']
});
$(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
.find(".portlet-header")
.addClass("ui-widget-header ui-corner-all")
.prepend('<span class="ui-icon ui-icon-plusthick"></span>')
.end()
.find(".portlet-content");
$(".portlet-header .ui-icon").click(function() {
$(this).toggleClass("ui-icon-minusthick");
$(this).parents(".portlet:first").find(".portlet-content").toggle();
});
});
</script>
</head>
<body>
<div class="demo">
<div class="column">
<div class="portlet">
<div class="portlet-header">Feeds</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
<div class="portlet">
<div class="portlet-header">News</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
</div>
<div class="column">
<div class="portlet">
<div class="portlet-header">Shopping</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
</div>
<div class="column">
<div class="portlet">
<div class="portlet-header">Links</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
<div class="portlet">
<div class="portlet-header">Images</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>Enable portlets (styled divs) as sortables and use the <strong>connectWith</strong> option to allow sorting between columns.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -1,46 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Sortable - Delay / Distance Demo</title>
<link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.3.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.sortable.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css">
.demo ul { list-style-type: none; margin: 0; padding: 0; margin-bottom: 15px; }
.demo li { margin: 5px; padding: 5px; font-size: 1.2em; }
</style>
<script type="text/javascript">
$(function() {
$("#sortable").sortable({
distance: 50
});
});
</script>
</head>
<body>
<div class="demo">
<p>Distance of 50px</p>
<ul id="sortable">
<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">Item 5</li>
</ul>
</div><!-- End demo -->
<div class="demo-description">
<p>
</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -1,62 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Sortable - Dropping on Empty Lists Demo</title>
<link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.3.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.sortable.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css">
.demo ul { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; background: #eee; padding: 5px; width: 143px;}
.demo li { margin: 5px; padding: 5px; font-size: 1.2em; width: 120px; }
</style>
<script type="text/javascript">
$(function() {
$("ul.droptrue").sortable({
connectWith: ['ul']
});
$("ul.dropfalse").sortable({
connectWith: ['ul'],
dropOnEmpty: false
});
});
</script>
</head>
<body>
<div class="demo">
<ul class='droptrue'>
<li class="ui-state-default">Can be dropped..</li>
<li class="ui-state-default">..on an empty list</li>
<li class="ui-state-default">Item 3</li>
<li class="ui-state-default">Item 4</li>
<li class="ui-state-default">Item 5</li>
</ul>
<ul class='dropfalse'>
<li class="ui-state-highlight">Cannot be dropped..</li>
<li class="ui-state-highlight">..on an empty list</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>
<ul class='droptrue'>
</ul>
<br clear="both" />
</div><!-- End demo -->
<div class="demo-description">
<p>
</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -1,55 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Sortable - Connect to Droppables Demo</title>
<link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.3.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.droppable.js"></script>
<script type="text/javascript" src="../../ui/ui.sortable.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css">
#sortable { list-style-type: none; margin: 0; padding: 0; }
#sortable li { margin: 5px; padding: 5px; font-size: 1.2em; width: 150px; }
#droppable { height: 80px; margin-bottom: 10px; padding: 5px; float: right; width: 200px; }
</style>
<script type="text/javascript">
$(function() {
$("#sortable").sortable();
$("#droppable").droppable({
activeClass: 'ui-state-hover',
hoverClass: 'ui-state-active',
drop: function(event, ui) {
$(this).addClass('ui-state-highlight').find('p').html('Dropped!');
}
});
});
</script>
</head>
<body>
<div class="demo">
<div id="droppable" class="ui-widget-header">
<p>Drop a list item on me - sortable items are automatically connected to droppables.</p>
</div>
<ul id="sortable">
<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">Item 5</li>
</ul>
</div><!-- End demo -->
<div class="demo-description">
<p>
</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -8,8 +8,8 @@
<script type="text/javascript" src="../../ui/ui.sortable.js"></script> <script type="text/javascript" src="../../ui/ui.sortable.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" /> <link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css"> <style type="text/css">
.demo ul { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; background: #eee; padding: 5px; width: 143px;} #sortable1, #sortable2, #sortable3 { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; background: #eee; padding: 5px; width: 143px;}
.demo li { margin: 5px; padding: 5px; font-size: 1.2em; width: 120px; } #sortable1 li, #sortable2 li, #sortable3 li { margin: 5px; padding: 5px; font-size: 1.2em; width: 120px; }
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
@ -27,7 +27,7 @@
<body> <body>
<div class="demo"> <div class="demo">
<ul class='droptrue'> <ul id="sortable1" class='droptrue'>
<li class="ui-state-default">Can be dropped..</li> <li class="ui-state-default">Can be dropped..</li>
<li class="ui-state-default">..on an empty list</li> <li class="ui-state-default">..on an empty list</li>
<li class="ui-state-default">Item 3</li> <li class="ui-state-default">Item 3</li>
@ -35,7 +35,7 @@
<li class="ui-state-default">Item 5</li> <li class="ui-state-default">Item 5</li>
</ul> </ul>
<ul class='dropfalse'> <ul id="sortable2" class='dropfalse'>
<li class="ui-state-highlight">Cannot be dropped..</li> <li class="ui-state-highlight">Cannot be dropped..</li>
<li class="ui-state-highlight">..on an empty list</li> <li class="ui-state-highlight">..on an empty list</li>
<li class="ui-state-highlight">Item 3</li> <li class="ui-state-highlight">Item 3</li>
@ -43,7 +43,7 @@
<li class="ui-state-highlight">Item 5</li> <li class="ui-state-highlight">Item 5</li>
</ul> </ul>
<ul class='droptrue'> <ul id="sortable3" class='droptrue'>
</ul> </ul>
<br clear="both" /> <br clear="both" />
@ -52,7 +52,11 @@
<div class="demo-description"> <div class="demo-description">
<p>Prevent all items in a list from being dropped into a separate, empty list using the <strong>dropOnEmpty</strong> option set to false. By default, sortable items can be dropped on empty lists.</p> <p>
Prevent all items in a list from being dropped into a separate, empty list
using the <code>dropOnEmpty</code> option set to <code>false</code>. By default,
sortable items can be dropped on empty lists.
</p>
</div><!-- End demo-description --> </div><!-- End demo-description -->

View File

@ -1,49 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Sortable - Floating Demo</title>
<link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.3.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.sortable.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css">
#sortable { list-style-type: none; margin: 0; padding: 0; }
#sortable li { margin: 3px; padding: 1px; float: left; width: 100px; height: 90px; font-size: 4em; text-align: center; }
</style>
<script type="text/javascript">
$(function() {
$("#sortable").sortable();
});
</script>
</head>
<body>
<div class="demo">
<ul id="sortable">
<li class="ui-state-default">1</li>
<li class="ui-state-default">2</li>
<li class="ui-state-default">3</li>
<li class="ui-state-default">4</li>
<li class="ui-state-default">5</li>
<li class="ui-state-default">6</li>
<li class="ui-state-default">7</li>
<li class="ui-state-default">8</li>
<li class="ui-state-default">9</li>
<li class="ui-state-default">10</li>
<li class="ui-state-default">11</li>
<li class="ui-state-default">12</li>
</ul>
</div><!-- End demo -->
<div class="demo-description">
<p>
</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -10,14 +10,13 @@
<h4>Examples</h4> <h4>Examples</h4>
<ul> <ul>
<li class="demo-config-on"><a href="default.html">Default functionality</a></li> <li class="demo-config-on"><a href="default.html">Default functionality</a></li>
<li><a href="tolerance.html">Drop tolerance (stickiness)</a></li>
<li><a href="placeholder.html">Drop placeholder</a></li> <li><a href="placeholder.html">Drop placeholder</a></li>
<li><a href="connect-lists.html">Connect lists</a></li> <li><a href="connect-lists.html">Connect lists</a></li>
<li><a href="empty-lists.html">Handle empty lists</a></li> <li><a href="empty-lists.html">Handle empty lists</a></li>
<li><a href="items.html">Include / exclude items</a></li> <li><a href="items.html">Include / exclude items</a></li>
<li><a href="delay-start.html">Delay start</a></li> <li><a href="delay-start.html">Delay start</a></li>
<li><a href="display-portlets.html">Display as portlets</a></li>
<li><a href="display-grid.html">Display as grid</a></li> <li><a href="display-grid.html">Display as grid</a></li>
<li><a href="portlets.html">Portlets</a></li>
</ul> </ul>
</div> </div>

View File

@ -8,33 +8,36 @@
<script type="text/javascript" src="../../ui/ui.sortable.js"></script> <script type="text/javascript" src="../../ui/ui.sortable.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" /> <link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css"> <style type="text/css">
#sortable, #sortable2 { list-style-type: none; margin: 0; padding: 0; } #sortable1, #sortable2 { list-style-type: none; margin: 0; padding: 0; }
.demo li { margin: 5px; padding: 3px; font-size: 1.2em; } #sortable1 li, #sortable2 li { margin: 0 5px 5px 5px; padding: 3px; }
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$("#sortable").sortable({ $("#sortable1").sortable({
items: 'li:not(.ui-state-disabled)' items: 'li:not(.ui-state-disabled)'
}); });
$("#sortable2").sortable({ $("#sortable2").sortable({
cancel: '.ui-state-disabled' cancel: '.ui-state-disabled'
}); });
$("#sortable1 li, #sortable2 li").disableSelection();
}); });
</script> </script>
</head> </head>
<body> <body>
<div class="demo"> <div class="demo">
<h3>Specify which items are sortable:</h3> <h3 class="docs">Specify which items are sortable:</h3>
<ul id="sortable"> <ul id="sortable1">
<li class="ui-state-default">Item 1</li> <li class="ui-state-default">Item 1</li>
<li class="ui-state-default ui-state-disabled">(I'm not sortable or a drop target)</li> <li class="ui-state-default ui-state-disabled">(I'm not sortable or a drop target)</li>
<li class="ui-state-default ui-state-disabled">(I'm not sortable or a drop target)</li> <li class="ui-state-default ui-state-disabled">(I'm not sortable or a drop target)</li>
<li class="ui-state-default">Item 4</li> <li class="ui-state-default">Item 4</li>
</ul> </ul>
<h3>Cancel sorting (but keep as drop targets):</h3> <h3 class="docs">Cancel sorting (but keep as drop targets):</h3>
<ul id="sortable2"> <ul id="sortable2">
<li class="ui-state-default">Item 1</li> <li class="ui-state-default">Item 1</li>
@ -47,8 +50,17 @@
<div class="demo-description"> <div class="demo-description">
<p>Specify which items are eligible to sort by passing a jQuery selector into the <strong>items</strong> option. Items excluded from this option are not sortable, nor are they valid targets for sortable items. </p> <p>
<p>To only prevent sorting on certain items, pass a jQuery selector into the <strong>cancel</strong> option. Cancelled items remain valid sort targets for others.</p> Specify which items are eligible to sort by passing a jQuery selector into
the <code>items</code> option. Items excluded from this option are not
sortable, nor are they valid targets for sortable items.
</p>
<p>
To only prevent sorting on certain items, pass a jQuery selector into the
<code>cancel</code> option. Cancelled items remain valid sort targets for
others.
</p>
</div><!-- End demo-description --> </div><!-- End demo-description -->

View File

@ -9,7 +9,9 @@
<link type="text/css" href="../demos.css" rel="stylesheet" /> <link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css"> <style type="text/css">
#sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; } #sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
#sortable li { margin: 5px; padding: 5px; font-size: 1.2em; } #sortable li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; }
html>body #sortable li { height: 1.5em; line-height: 1.2em; }
.ui-state-highlight { height: 1.5em; line-height: 1.2em; }
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
@ -36,7 +38,13 @@
<div class="demo-description"> <div class="demo-description">
<p>When dragging a sortable item to a new location, other items will make room for the that item by shifting to allow white space between them. Pass a class into the <strong>placeholder</strong> option to style that space to be visible. Use the boolean <strong>forcePlaceholderSize</strong> option to set dimensions on the placeholder.</p> <p>
When dragging a sortable item to a new location, other items will make room
for the that item by shifting to allow white space between them. Pass a
class into the <code>placeholder</code> option to style that space to
be visible. Use the boolean <code>forcePlaceholderSize</code> option
to set dimensions on the placeholder.
</p>
</div><!-- End demo-description --> </div><!-- End demo-description -->

View File

@ -1,7 +1,7 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<title>jQuery UI Sortable - Portlets Demo</title> <title>jQuery UI Sortable - Portlets</title>
<link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" /> <link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.3.js"></script> <script type="text/javascript" src="../../jquery-1.3.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script> <script type="text/javascript" src="../../ui/ui.core.js"></script>
@ -9,11 +9,11 @@
<link type="text/css" href="../demos.css" rel="stylesheet" /> <link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css"> <style type="text/css">
.column { width: 170px; float: left; padding-bottom: 100px; } .column { width: 170px; float: left; padding-bottom: 100px; }
.portlet { margin: 1em; } .portlet { margin: 0 1em 1em 1em; }
.portlet-header { margin: 0.3em; padding-left: 0.2em; } .portlet-header { margin: 0.3em; padding-bottom: 4px; padding-left: 0.2em; }
.portlet-header .ui-icon { float: right; } .portlet-header .ui-icon { float: right; }
.portlet-content { padding: 0.4em; } .portlet-content { padding: 0.4em; }
.ui-sortable-placeholder { border: 1px dotted black; visibility: visible !important; } .ui-sortable-placeholder { border: 1px dotted black; visibility: visible !important; height: 50px !important; }
.ui-sortable-placeholder * { visibility: hidden; } .ui-sortable-placeholder * { visibility: hidden; }
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
@ -41,38 +41,38 @@
<div class="column"> <div class="column">
<div class="portlet"> <div class="portlet">
<div class="portlet-header">Feeds</div> <div class="portlet-header">Feeds</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div> <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div> </div>
<div class="portlet"> <div class="portlet">
<div class="portlet-header">News</div> <div class="portlet-header">News</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div> <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div> </div>
</div> </div>
<div class="column"> <div class="column">
<div class="portlet"> <div class="portlet">
<div class="portlet-header">Shopping</div> <div class="portlet-header">Shopping</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div> <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div> </div>
</div> </div>
<div class="column"> <div class="column">
<div class="portlet"> <div class="portlet">
<div class="portlet-header">Links</div> <div class="portlet-header">Links</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div> <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div> </div>
<div class="portlet"> <div class="portlet">
<div class="portlet-header">Images</div> <div class="portlet-header">Images</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div> <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div> </div>
</div> </div>
@ -81,7 +81,8 @@
<div class="demo-description"> <div class="demo-description">
<p> <p>
Enable portlets (styled divs) as sortables and use the <code>connectWith</code>
option to allow sorting between columns.
</p> </p>
</div><!-- End demo-description --> </div><!-- End demo-description -->

View File

@ -1,52 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Sortable - Drop tolerance (stickiness)</title>
<link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.3.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.sortable.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" />
<style type="text/css">
#sortable-tolerance-default, #sortable-tolerance-pointer { list-style-type: none; margin: 0; padding: 0; float: left; }
#sortable-tolerance-default li, #sortable-tolerance-pointer li { margin: 3px; padding: 1px; float: left; width: 100px; height: 90px; font-size: 1.3em; text-align: center; }
</style>
<script type="text/javascript">
$(function() {
$("#sortable-tolerance-default").sortable({
tolerance: 'default'
});
$("#sortable-tolerance-pointer").sortable({
tolerance: 'pointer'
});
});
</script>
</head>
<body>
<div class="demo">
<ul id="sortable-tolerance-default">
<li class="ui-state-default"><div class="ui-icon ui-icon-arrow-4"></div>Default tolerance</li>
<li class="ui-state-default"><div class="ui-icon ui-icon-arrow-4"></div>2</li>
<li class="ui-state-default"><div class="ui-icon ui-icon-arrow-4"></div>3</li>
</ul>
<br style="clear:both;" />
<br style="clear:both;" />
<ul id="sortable-tolerance-pointer">
<li class="ui-state-default"><div class="ui-icon ui-icon-arrowthick-1-ne"></div>Pointer tolerance</li>
<li class="ui-state-default"><div class="ui-icon ui-icon-arrowthick-1-ne"></div>2</li>
<li class="ui-state-default"><div class="ui-icon ui-icon-arrowthick-1-ne"></div>3</li>
</ul>
</div><!-- End demo -->
<div class="demo-description">
<p>Set the stickiness of drop areas using the <strong>tolerance</strong> option. Specify whether the drop should occur when either the pointer or intersection (mid-point of the sortable item) crosses the drop area's boundary. By default, the script guesses which option is best to use for each drag.</p>
</div><!-- End demo-description -->
</body>
</html>