你想要这样的东西吗?
HTML
<div class="left">left</div>
<div class="center">
<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">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>
<div class="right">right</div>
CSS
body, html {
position: relative;
height: 100%;
width: 100%;
padding: 0;
margin: 0;
}
.left, .right {
height: 100%;
width: 170px;
float: left;
background: #e0e0e0;
}
.left {
border-right: 3px solid #DDD;
margin-right: 4px;
}
.right {
border-left: 3px solid #DDD;
left: 0!important;
margin-left: 4px;
}
.center {
height: 100%;
float: left;
}
.column { width: 50%; float: left; padding-bottom: 100px; }
.portlet { margin: 0 1em 1em 0;}
.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; height: 50px !important; }
.ui-sortable-placeholder * { visibility: hidden; }
jQuery
$(function() {
var maxBorderCellWidth = 250;
var minBorderCellWidth = 150;
var resizeCenter = function () {
var clientWidth = $(document).innerWidth();
var leftWidth = $( ".left" ).outerWidth(true);
var rightWidth = $( ".right" ).outerWidth(true);
console.log(clientWidth); $('.center').width(clientWidth-leftWidth-rightWidth);
}
$( ".left" ).resizable({
maxWidth: maxBorderCellWidth,
minWidth: minBorderCellWidth,
handles: 'e',
resize: function (event, ui){
resizeCenter();
}
});
$( ".right" ).resizable({
maxWidth: maxBorderCellWidth,
minWidth: minBorderCellWidth,
handles: 'w',
resize: function (event, ui){
resizeCenter();
}
});
$( ".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-minusthick'></span>")
.end()
.find( ".portlet-content" );
$( ".portlet-header .ui-icon" ).click(function() {
$( this ).toggleClass( "ui-icon-minusthick" ).toggleClass( "ui-icon-plusthick" );
$( this ).parents( ".portlet:first" ).find( ".portlet-content" ).toggle();
});
$( ".column" ).disableSelection();
resizeCenter();
$(window).resize(function () {
console.log("test");
resizeCenter();
});
});