I have two elements which are draggable and resizeable. They are aline horizontally. My problem is when I attempted to resize the first element at the top, the second element position below will automatically cover the first element.
Below is the style:
<style>
#request-grid { width: 500px; min-height: 200px; margin: 10px; padding: 0.5em;}
#bb-clist { width: 500px; min-height: 200px; margin: 10px; padding: 0.5em;}
.ui-resizable-helper { border: 2px dotted #00F; }
</style>
Below is the jqueryui code:
$( "#request-grid" ).draggable({containment: "#content", scroll: true, stack: "#content div" });
$( "#bb-clist" ).draggable({containment: "#content", scroll:true, stack: "#content div"});
$( "#request-grid" ).resizable({
helper: "ui-resizable-helper", containment: "#content"
});
$( "#bb-clist" ).resizable({
helper: "ui-resizable-helper", containment: "#content"
});
Below is the html element:
<div id="request-grid" class="ui-widget-content">
</div>
<div id="bb-clist" class="ui-widget-content">
</div>
How will I solve this problem without the other element covering/overlapping the other element when resizing.
Thanks.
<div>
<div id="request-grid"></div>
<br/>
<div id="bb-clist"></div>
</div>
#request-grid {
height:100px;
width: 200px;
min-height: 100px;
margin: 10px;
padding: 0.5em;
background-color:pink;
}
#bb-clist {
height:100px;
width: 200px;
min-height: 100px;
margin: 10px;
padding: 0.5em;
background-color:blue;
}
.ui-resizable-helper {
border: 2px dotted #00F;
}
$(document).ready(function () {
$("#request-grid").draggable({
containment: "#document",
scroll: false,
stack: "#content div"
});
$("#bb-clist").draggable({
containment: "#document",
scroll: false,
stack: "#content div"
});
$("#request-grid").resizable({
helper: "ui-resizable-helper",
containment: "document",
resize: function (event, ui) {
var height = (ui.size.height + 'px');
$('#bb-clist').css('posotion', 'absolute').css('top', height);
},
stop: function (event, ui) {
var h2 = (ui.size.height);
if (h2 < 200) {
h2 = 100; // set default min-height if re-sized less than min-height.
}
$('#bb-clist').css('posotion', 'absolute').css('top', h2);
}
});
$("#bb-clist").resizable({
helper: "ui-resizable-helper",
containment: "document"
});
});
Working Demo http://jsfiddle.net/cse_tushar/qkKV6/