这是一个显示问题的jsfiddle:http://jsfiddle.net/FQxYB/9/
为了避免发布错误“不要只是链接到小提琴”...这里是小提琴细节(为什么不能通过stackoverflow自动完成?)。
小提琴HTML:
<div class="gridster">
<ul>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div class='portlet'>
<span>Something small that fits</span>
</div>
</li>
<li data-row="2" data-col="1" data-sizex="1" data-sizey="1">
<div>
<span>Something like a header</span>
</div>
<div class='portlet'>
<table>
<tr>
<td>r1 c1</td>
<td>r1 c2</td>
</tr>
<tr>
<td>r2 c1</td>
<td>r2 c2</td>
</tr>
<tr>
<td>r3 c1</td>
<td>r3 c2</td>
</tr>
<tr>
<td>r4 c1</td>
<td>r4 c2</td>
</tr>
<tr>
<td>r5 c1</td>
<td>r5 c2</td>
</tr>
<tr>
<td>r6 c1</td>
<td>r6 c2</td>
</tr>
<tr>
<td>r7 c1</td>
<td>r7 c2</td>
</tr>
<tr>
<td>r8 c1</td>
<td>r8 c2</td>
</tr>
<tr>
<td>r9 c1</td>
<td>r9 c2</td>
</tr>
<tr>
<td>r10 c1</td>
<td>r10 c2</td>
</tr>
</table>
</div>
</li>
</ul>
小提琴代码:
$(function(){
$(".gridster ul").gridster({
widget_margins: [15, 15],
widget_base_dimensions: [100, 100]
});
});
小提琴CSS:
.portlet
{
height: 100%;
width: 100%;
overflow: auto;
}
.gridster {
position:relative;
background-color: gray;
}
li {
background-color: white;
width: 150px;
height: 150px;
border: solid 2px black;
}
.gridster > * {
margin: 0 auto;
-webkit-transition: height .4s;
-moz-transition: height .4s;
-o-transition: height .4s;
-ms-transition: height .4s;
transition: height .4s;
}
.gridster .gs_w{
z-index: 2;
position: absolute;
}
.ready .gs_w:not(.preview-holder) {
-webkit-transition: opacity .3s, left .3s, top .3s;
-moz-transition: opacity .3s, left .3s, top .3s;
-o-transition: opacity .3s, left .3s, top .3s;
transition: opacity .3s, left .3s, top .3s;
}
.ready .gs_w:not(.preview-holder) {
-webkit-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
-moz-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
-o-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
}
.gridster .preview-holder {
z-index: 1;
position: absolute;
background-color: #fff;
border-color: #fff;
opacity: 0.3;
}
.gridster .player-revert {
z-index: 10!important;
-webkit-transition: left .3s, top .3s!important;
-moz-transition: left .3s, top .3s!important;
-o-transition: left .3s, top .3s!important;
transition: left .3s, top .3s!important;
}
.gridster .dragging {
z-index: 10!important;
-webkit-transition: all 0s !important;
-moz-transition: all 0s !important;
-o-transition: all 0s !important;
transition: all 0s !important;
}
/* Uncomment this if you set helper : "clone" in draggable options */
/*.gridster .player {
opacity:0;
}*/
小提琴资源:http://gridster.net/dist/jquery.gridster.js
对于第二个方格(下方)我需要底部div不超过LI的范围。
粗略地说,“标题”div的内容可以是任何大小(标题内容根据上下文而变化)。但是“body”div的内容需要在必要时显示滚动条并保持在LI的范围内。
我“像海一样迷失”。我尝试过一系列不同的方案......但是没有一个方案能够接近(主要是使用包装div和display:table / table-row / table-cell)。
非常感谢您的帮助!