| 1 | <!doctype html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 6 | <title>jQuery UI Sortable - Portlets</title> |
| 7 | <link rel="stylesheet" href="../../themes/base/all.css"> |
| 8 | <link rel="stylesheet" href="../demos.css"> |
| 9 | <style> |
| 10 | body { |
| 11 | min-width: 520px; |
| 12 | } |
| 13 | .column { |
| 14 | width: 170px; |
| 15 | float: left; |
| 16 | padding-bottom: 100px; |
| 17 | } |
| 18 | .portlet { |
| 19 | margin: 0 1em 1em 0; |
| 20 | padding: 0.3em; |
| 21 | } |
| 22 | .portlet-header { |
| 23 | padding: 0.2em 0.3em; |
| 24 | margin-bottom: 0.5em; |
| 25 | position: relative; |
| 26 | } |
| 27 | .portlet-toggle { |
| 28 | position: absolute; |
| 29 | top: 50%; |
| 30 | right: 0; |
| 31 | margin-top: -8px; |
| 32 | } |
| 33 | .portlet-content { |
| 34 | padding: 0.4em; |
| 35 | } |
| 36 | .portlet-placeholder { |
| 37 | border: 1px dotted black; |
| 38 | margin: 0 1em 1em 0; |
| 39 | height: 50px; |
| 40 | } |
| 41 | </style> |
| 42 | <script src="../../external/requirejs/require.js"></script> |
| 43 | <script src="../bootstrap.js"> |
| 44 | $( ".column" ).sortable({ |
| 45 | connectWith: ".column", |
| 46 | handle: ".portlet-header", |
| 47 | cancel: ".portlet-toggle", |
| 48 | placeholder: "portlet-placeholder ui-corner-all" |
| 49 | }); |
| 50 | |
| 51 | $( ".portlet" ) |
| 52 | .addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" ) |
| 53 | .find( ".portlet-header" ) |
| 54 | .addClass( "ui-widget-header ui-corner-all" ) |
| 55 | .prepend( "<span class='ui-icon ui-icon-minusthick portlet-toggle'></span>"); |
| 56 | |
| 57 | $( ".portlet-toggle" ).on( "click", function() { |
| 58 | var icon = $( this ); |
| 59 | icon.toggleClass( "ui-icon-minusthick ui-icon-plusthick" ); |
| 60 | icon.closest( ".portlet" ).find( ".portlet-content" ).toggle(); |
| 61 | }); |
| 62 | </script> |
| 63 | </head> |
| 64 | <body> |
| 65 | |
| 66 | <div class="column"> |
| 67 | |
| 68 | <div class="portlet"> |
| 69 | <div class="portlet-header">Feeds</div> |
| 70 | <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div> |
| 71 | </div> |
| 72 | |
| 73 | <div class="portlet"> |
| 74 | <div class="portlet-header">News</div> |
| 75 | <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div> |
| 76 | </div> |
| 77 | |
| 78 | </div> |
| 79 | |
| 80 | <div class="column"> |
| 81 | |
| 82 | <div class="portlet"> |
| 83 | <div class="portlet-header">Shopping</div> |
| 84 | <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div> |
| 85 | </div> |
| 86 | |
| 87 | </div> |
| 88 | |
| 89 | <div class="column"> |
| 90 | |
| 91 | <div class="portlet"> |
| 92 | <div class="portlet-header">Links</div> |
| 93 | <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div> |
| 94 | </div> |
| 95 | |
| 96 | <div class="portlet"> |
| 97 | <div class="portlet-header">Images</div> |
| 98 | <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div> |
| 99 | </div> |
| 100 | |
| 101 | </div> |
| 102 | |
| 103 | <div class="demo-description"> |
| 104 | <p> |
| 105 | Enable portlets (styled divs) as sortables and use the <code>connectWith</code> |
| 106 | option to allow sorting between columns. |
| 107 | </p> |
| 108 | </div> |
| 109 | </body> |
| 110 | </html> |