diff options
author | Richard Worth <rdworth@gmail.com> | 2009-01-20 13:12:22 +0000 |
---|---|---|
committer | Richard Worth <rdworth@gmail.com> | 2009-01-20 13:12:22 +0000 |
commit | d578a66d49f0779de7d99b68d35d97e5600d3167 (patch) | |
tree | 96451908ecee9a9ef11fbfbf2da1336ae7e81456 | |
parent | 670d3e0ac9cc97b440b7b1df23003472c437bc3f (diff) | |
download | jquery-ui-d578a66d49f0779de7d99b68d35d97e5600d3167.tar.gz jquery-ui-d578a66d49f0779de7d99b68d35d97e5600d3167.zip |
demos/sortable: some cleanup and consistency
-rw-r--r-- | demos/sortable/connect-lists.html | 11 | ||||
-rw-r--r-- | demos/sortable/connectwith.html | 52 | ||||
-rw-r--r-- | demos/sortable/default.html | 8 | ||||
-rw-r--r-- | demos/sortable/delay-start.html | 26 | ||||
-rw-r--r-- | demos/sortable/delay.html | 46 | ||||
-rw-r--r-- | demos/sortable/display-grid.html | 5 | ||||
-rw-r--r-- | demos/sortable/display-portlets.html | 88 | ||||
-rw-r--r-- | demos/sortable/distance.html | 46 | ||||
-rw-r--r-- | demos/sortable/droponempty.html | 62 | ||||
-rw-r--r-- | demos/sortable/droppable.html | 55 | ||||
-rw-r--r-- | demos/sortable/empty-lists.html | 16 | ||||
-rw-r--r-- | demos/sortable/floating.html | 49 | ||||
-rw-r--r-- | demos/sortable/index.html | 5 | ||||
-rw-r--r-- | demos/sortable/items.html | 28 | ||||
-rw-r--r-- | demos/sortable/placeholder.html | 12 | ||||
-rw-r--r-- | demos/sortable/portlets.html | 55 | ||||
-rw-r--r-- | demos/sortable/tolerance.html | 52 |
17 files changed, 105 insertions, 511 deletions
diff --git a/demos/sortable/connect-lists.html b/demos/sortable/connect-lists.html index 569dbfa29..6497b5fa1 100644 --- a/demos/sortable/connect-lists.html +++ b/demos/sortable/connect-lists.html @@ -8,8 +8,8 @@ <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; } + #sortable1, #sortable2 { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; } + #sortable1 li, #sortable2 li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; width: 120px; } </style> <script type="text/javascript"> $(function() { @@ -42,7 +42,12 @@ <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 --> diff --git a/demos/sortable/connectwith.html b/demos/sortable/connectwith.html deleted file mode 100644 index b3f21d075..000000000 --- a/demos/sortable/connectwith.html +++ /dev/null @@ -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> diff --git a/demos/sortable/default.html b/demos/sortable/default.html index bd58f4994..dab3907de 100644 --- a/demos/sortable/default.html +++ b/demos/sortable/default.html @@ -9,7 +9,7 @@ <link type="text/css" href="../demos.css" rel="stylesheet" /> <style type="text/css"> #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; } </style> <script type="text/javascript"> @@ -35,7 +35,11 @@ <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 --> diff --git a/demos/sortable/delay-start.html b/demos/sortable/delay-start.html index 9952c830e..f5b1cc980 100644 --- a/demos/sortable/delay-start.html +++ b/demos/sortable/delay-start.html @@ -8,34 +8,36 @@ <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; } + #sortable1, #sortable2 { list-style-type: none; margin: 0; padding: 0; margin-bottom: 15px; } + #sortable1 li, #sortable2 li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; } </style> <script type="text/javascript"> $(function() { - $("#sortable").sortable({ - delay: 1000 + $("#sortable1").sortable({ + delay: 300 }); $("#sortable2").sortable({ - distance: 50 + distance: 15 }); + + $("li").disableSelection(); }); </script> </head> <body> <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 2</li> <li class="ui-state-default">Item 3</li> <li class="ui-state-default">Item 4</li> </ul> -<h3>Distance delay of 50px:</h3> +<h3 class="docs">Distance delay of 15px:</h3> <ul id="sortable2"> <li class="ui-state-default">Item 1</li> @@ -48,7 +50,13 @@ <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 --> diff --git a/demos/sortable/delay.html b/demos/sortable/delay.html deleted file mode 100644 index 2b9a099e0..000000000 --- a/demos/sortable/delay.html +++ /dev/null @@ -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> diff --git a/demos/sortable/display-grid.html b/demos/sortable/display-grid.html index c0081a3cb..7435f60e7 100644 --- a/demos/sortable/display-grid.html +++ b/demos/sortable/display-grid.html @@ -39,7 +39,10 @@ <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 --> diff --git a/demos/sortable/display-portlets.html b/demos/sortable/display-portlets.html deleted file mode 100644 index c71dcd2d3..000000000 --- a/demos/sortable/display-portlets.html +++ /dev/null @@ -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> diff --git a/demos/sortable/distance.html b/demos/sortable/distance.html deleted file mode 100644 index 4e458c4dc..000000000 --- a/demos/sortable/distance.html +++ /dev/null @@ -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> diff --git a/demos/sortable/droponempty.html b/demos/sortable/droponempty.html deleted file mode 100644 index 1a548c05a..000000000 --- a/demos/sortable/droponempty.html +++ /dev/null @@ -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> diff --git a/demos/sortable/droppable.html b/demos/sortable/droppable.html deleted file mode 100644 index 953e7ef1f..000000000 --- a/demos/sortable/droppable.html +++ /dev/null @@ -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> diff --git a/demos/sortable/empty-lists.html b/demos/sortable/empty-lists.html index 7c66515eb..426c0ce6a 100644 --- a/demos/sortable/empty-lists.html +++ b/demos/sortable/empty-lists.html @@ -8,8 +8,8 @@ <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; } + #sortable1, #sortable2, #sortable3 { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; background: #eee; padding: 5px; width: 143px;} + #sortable1 li, #sortable2 li, #sortable3 li { margin: 5px; padding: 5px; font-size: 1.2em; width: 120px; } </style> <script type="text/javascript"> $(function() { @@ -27,7 +27,7 @@ <body> <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">..on an empty list</li> <li class="ui-state-default">Item 3</li> @@ -35,7 +35,7 @@ <li class="ui-state-default">Item 5</li> </ul> -<ul class='dropfalse'> +<ul id="sortable2" 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> @@ -43,7 +43,7 @@ <li class="ui-state-highlight">Item 5</li> </ul> -<ul class='droptrue'> +<ul id="sortable3" class='droptrue'> </ul> <br clear="both" /> @@ -52,7 +52,11 @@ <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 --> diff --git a/demos/sortable/floating.html b/demos/sortable/floating.html deleted file mode 100644 index 8ad082b74..000000000 --- a/demos/sortable/floating.html +++ /dev/null @@ -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> diff --git a/demos/sortable/index.html b/demos/sortable/index.html index 0c3bd7196..e19c83f2b 100644 --- a/demos/sortable/index.html +++ b/demos/sortable/index.html @@ -10,14 +10,13 @@ <h4>Examples</h4> <ul> <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="connect-lists.html">Connect 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="display-portlets.html">Display as portlets</a></li> <li><a href="display-grid.html">Display as grid</a></li> + <li><a href="portlets.html">Portlets</a></li> </ul> </div> diff --git a/demos/sortable/items.html b/demos/sortable/items.html index 54b63ed8a..9664ae3db 100644 --- a/demos/sortable/items.html +++ b/demos/sortable/items.html @@ -8,33 +8,36 @@ <script type="text/javascript" src="../../ui/ui.sortable.js"></script> <link type="text/css" href="../demos.css" rel="stylesheet" /> <style type="text/css"> - #sortable, #sortable2 { list-style-type: none; margin: 0; padding: 0; } - .demo li { margin: 5px; padding: 3px; font-size: 1.2em; } + #sortable1, #sortable2 { list-style-type: none; margin: 0; padding: 0; } + #sortable1 li, #sortable2 li { margin: 0 5px 5px 5px; padding: 3px; } </style> <script type="text/javascript"> $(function() { - $("#sortable").sortable({ + $("#sortable1").sortable({ items: 'li:not(.ui-state-disabled)' }); + $("#sortable2").sortable({ cancel: '.ui-state-disabled' }); + + $("#sortable1 li, #sortable2 li").disableSelection(); }); </script> </head> <body> <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 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> </ul> -<h3>Cancel sorting (but keep as drop targets):</h3> +<h3 class="docs">Cancel sorting (but keep as drop targets):</h3> <ul id="sortable2"> <li class="ui-state-default">Item 1</li> @@ -47,8 +50,17 @@ <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>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> +<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 --> diff --git a/demos/sortable/placeholder.html b/demos/sortable/placeholder.html index 057297282..0f46dac7d 100644 --- a/demos/sortable/placeholder.html +++ b/demos/sortable/placeholder.html @@ -9,7 +9,9 @@ <link type="text/css" href="../demos.css" rel="stylesheet" /> <style type="text/css"> #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> <script type="text/javascript"> $(function() { @@ -36,7 +38,13 @@ <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 --> diff --git a/demos/sortable/portlets.html b/demos/sortable/portlets.html index 95dc40e11..036819980 100644 --- a/demos/sortable/portlets.html +++ b/demos/sortable/portlets.html @@ -1,7 +1,7 @@ <!doctype html> <html lang="en"> <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" /> <script type="text/javascript" src="../../jquery-1.3.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" /> <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 { margin: 0 1em 1em 1em; } + .portlet-header { margin: 0.3em; padding-bottom: 4px; 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 { border: 1px dotted black; visibility: visible !important; height: 50px !important; } .ui-sortable-placeholder * { visibility: hidden; } </style> <script type="text/javascript"> @@ -41,38 +41,38 @@ <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 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 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 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> @@ -81,7 +81,8 @@ <div class="demo-description"> <p> - + Enable portlets (styled divs) as sortables and use the <code>connectWith</code> + option to allow sorting between columns. </p> </div><!-- End demo-description --> diff --git a/demos/sortable/tolerance.html b/demos/sortable/tolerance.html deleted file mode 100644 index f9ad40196..000000000 --- a/demos/sortable/tolerance.html +++ /dev/null @@ -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> |