jquery-ui/demos/sortable/portlets.html

116 lines
2.7 KiB
HTML
Raw Normal View History

2012-09-10 15:33:46 +00:00
<!doctype html>
2009-01-05 22:28:56 +00:00
<html lang="en">
<head>
2010-10-13 19:23:42 +00:00
<meta charset="utf-8">
<title>jQuery UI Sortable - Portlets</title>
<link rel="stylesheet" href="../../themes/base/all.css">
<script src="../../external/jquery/jquery.js"></script>
<script src="../../ui/core.js"></script>
<script src="../../ui/widget.js"></script>
<script src="../../ui/mouse.js"></script>
<script src="../../ui/sortable.js"></script>
2010-10-13 19:23:42 +00:00
<link rel="stylesheet" href="../demos.css">
<style>
2013-05-16 14:08:47 +00:00
body {
min-width: 520px;
}
.column {
width: 170px;
float: left;
padding-bottom: 100px;
}
.portlet {
margin: 0 1em 1em 0;
padding: 0.3em;
}
.portlet-header {
padding: 0.2em 0.3em;
margin-bottom: 0.5em;
position: relative;
}
.portlet-toggle {
position: absolute;
top: 50%;
right: 0;
margin-top: -8px;
}
.portlet-content {
padding: 0.4em;
}
.portlet-placeholder {
border: 1px dotted black;
margin: 0 1em 1em 0;
height: 50px;
}
2009-01-05 22:28:56 +00:00
</style>
2010-10-13 19:23:42 +00:00
<script>
2009-01-05 22:28:56 +00:00
$(function() {
2010-10-13 19:23:42 +00:00
$( ".column" ).sortable({
2013-05-16 14:08:47 +00:00
connectWith: ".column",
handle: ".portlet-header",
cancel: ".portlet-toggle",
placeholder: "portlet-placeholder ui-corner-all"
2009-01-05 22:28:56 +00:00
});
2013-05-16 14:08:47 +00:00
$( ".portlet" )
.addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
2010-10-13 19:23:42 +00:00
.find( ".portlet-header" )
.addClass( "ui-widget-header ui-corner-all" )
2013-05-16 14:08:47 +00:00
.prepend( "<span class='ui-icon ui-icon-minusthick portlet-toggle'></span>");
2009-01-05 22:28:56 +00:00
2013-05-16 14:08:47 +00:00
$( ".portlet-toggle" ).click(function() {
var icon = $( this );
icon.toggleClass( "ui-icon-minusthick ui-icon-plusthick" );
icon.closest( ".portlet" ).find( ".portlet-content" ).toggle();
2009-01-05 22:28:56 +00:00
});
});
</script>
</head>
<body>
<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>
2012-09-10 15:33:46 +00:00
<div class="portlet">
<div class="portlet-header">News</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
2009-01-05 22:28:56 +00:00
</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>
2009-01-05 22:28:56 +00:00
</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>
2012-09-10 15:33:46 +00:00
<div class="portlet">
<div class="portlet-header">Images</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
2009-01-05 22:28:56 +00:00
</div>
2010-10-13 19:23:42 +00:00
<div class="demo-description">
2009-01-05 22:28:56 +00:00
<p>
Enable portlets (styled divs) as sortables and use the <code>connectWith</code>
option to allow sorting between columns.
2009-01-05 22:28:56 +00:00
</p>
2012-09-10 15:33:46 +00:00
</div>
2009-01-05 22:28:56 +00:00
</body>
</html>