In this plunk我想用jQuery UI实现拆分器。有三个div在边界移动时应该调整大小。实现与jquery用户界面不工作的拆分器
我计算divs的初始宽度/高度并添加/减去偏移量。但这不起作用。这段代码有什么问题?
HTML
<div style="width:180px;height:200px;float:left;background-color:orange">
<div id="cols" style="width:180px;height:200px"></div>
<div id="div1"></div>
<div id="tabs" style="width:180px;height:200px;background-color:blue;float:left"></div>
</div>
<div id="div2"></div>
<div id="canvas" style="width:200px;height:406px;background-color:red;float:left"></div>
的Javascript
var colsH, tabsH, colsW, canvasW;
$("#div1").draggable({
axis: "y",
start: function() {
colsH = $("#cols").height();
tabsH = $("#tabs").height();
},
drag: function(event,ui) {
var shift = ui.offset.top;
$("#cols").height(colsH + shift);
$("#tabs").height(tabsH - shift);
}
});
$("#div2").draggable({
axis: "x",
start: function() {
colsW = $("#cols").width();
canvasW = $("#canvas").width();
},
drag: function(event,ui) {
var shift = ui.offset.left;
$("#cols").width(colsW - shift);
$("#tabs").width(colsW - shift);
$("#canvas").width(colsW + shift);
}
});
你能解释一下你的意思吗?splitter *? –
可拖动的水平和垂直条,调整div的大小 – ps0604