|
11 | 11 | <script src="../../ui/jquery.ui.sortable.js"></script>
|
12 | 12 | <link rel="stylesheet" href="../demos.css">
|
13 | 13 | <style>
|
14 |
| - body { min-width: 520px; } |
15 |
| - .column { width: 170px; float: left; padding-bottom: 100px; } |
16 |
| - .portlet { margin: 0 1em 1em 0; } |
17 |
| - .portlet-header { margin: 0.3em; padding-bottom: 4px; padding-left: 0.2em; } |
18 |
| - .portlet-header .ui-icon { float: right; } |
19 |
| - .portlet-content { padding: 0.4em; } |
20 |
| - .ui-sortable-placeholder { border: 1px dotted black; visibility: visible !important; height: 50px !important; } |
21 |
| - .ui-sortable-placeholder * { visibility: hidden; } |
| 14 | + body { |
| 15 | + min-width: 520px; |
| 16 | + } |
| 17 | + .column { |
| 18 | + width: 170px; |
| 19 | + float: left; |
| 20 | + padding-bottom: 100px; |
| 21 | + } |
| 22 | + .portlet { |
| 23 | + margin: 0 1em 1em 0; |
| 24 | + padding: 0.3em; |
| 25 | + } |
| 26 | + .portlet-header { |
| 27 | + padding: 0.2em 0.3em; |
| 28 | + margin-bottom: 0.5em; |
| 29 | + position: relative; |
| 30 | + } |
| 31 | + .portlet-toggle { |
| 32 | + position: absolute; |
| 33 | + top: 50%; |
| 34 | + right: 0; |
| 35 | + margin-top: -8px; |
| 36 | + } |
| 37 | + .portlet-content { |
| 38 | + padding: 0.4em; |
| 39 | + } |
| 40 | + .portlet-placeholder { |
| 41 | + border: 1px dotted black; |
| 42 | + margin: 0 1em 1em 0; |
| 43 | + height: 50px; |
| 44 | + } |
22 | 45 | </style>
|
23 | 46 | <script>
|
24 | 47 | $(function() {
|
25 | 48 | $( ".column" ).sortable({
|
26 |
| - connectWith: ".column" |
| 49 | + connectWith: ".column", |
| 50 | + handle: ".portlet-header", |
| 51 | + cancel: ".portlet-toggle", |
| 52 | + placeholder: "portlet-placeholder ui-corner-all" |
27 | 53 | });
|
28 | 54 |
|
29 |
| - $( ".portlet" ).addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" ) |
| 55 | + $( ".portlet" ) |
| 56 | + .addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" ) |
30 | 57 | .find( ".portlet-header" )
|
31 | 58 | .addClass( "ui-widget-header ui-corner-all" )
|
32 |
| - .prepend( "<span class='ui-icon ui-icon-minusthick'></span>") |
33 |
| - .end() |
34 |
| - .find( ".portlet-content" ); |
| 59 | + .prepend( "<span class='ui-icon ui-icon-minusthick portlet-toggle'></span>"); |
35 | 60 |
|
36 |
| - $( ".portlet-header .ui-icon" ).click(function() { |
37 |
| - $( this ).toggleClass( "ui-icon-minusthick" ).toggleClass( "ui-icon-plusthick" ); |
38 |
| - $( this ).parents( ".portlet:first" ).find( ".portlet-content" ).toggle(); |
| 61 | + $( ".portlet-toggle" ).click(function() { |
| 62 | + var icon = $( this ); |
| 63 | + icon.toggleClass( "ui-icon-minusthick ui-icon-plusthick" ); |
| 64 | + icon.closest( ".portlet" ).find( ".portlet-content" ).toggle(); |
39 | 65 | });
|
40 |
| - |
41 |
| - $( ".column" ).disableSelection(); |
42 | 66 | });
|
43 | 67 | </script>
|
44 | 68 | </head>
|
|
0 commit comments