As depicted by the image I want to resize the "Document Icons" Div by dragging upwards and it should be accommodated by decreasing the height of "Document Viewer". I need a temporary slider to show the dragging on the screen.
Question modified: HTML
<div id="centerDiv" class="centerDiv" style="position:relative;float: left;width: 63%;height: 600px;border-right: 10px solid #ddd;">
<div class="header" style="width: 100%;height: 15px;background-color: #ddd;"></div>
<div class="documentViewer" id="documentViewer" style="width: 100%;height: 500px;margin-bottom: 5px;">
<iframe id="frameValue" name="frameValue" src="NoDocument.html" width="100%" height="500px" style="margin-bottom: 5px;"></iframe>
</div>
<div class="dragDiv" id="dragDiv" style="width: 100%;height: 15px;cursor: row-resize;background-color: green;"></div>
<div class="iconList" id="iconParent" style="position:relative;width: 100%;height: 70px;background-color: #ddd;"></div>
Jquery
$('#dragBar').mousedown(function(e) {
e.preventDefault();
dragging = true;
var main = $('#documentViewer');
var scrollBar = $("<div>'",
{id:'scrollBar',
css: {
height: '5px',
top:'530px',
left:'40px',
z-index:'100',
background-color: 'red'
}
}).appendTo('body');
$(document).mousemove(function(e) {
scrollBar.css("top",e.pageX+2);
});
if(dragging) {
$(window).mouseup(function(e) {
$('#position').html(e.pageX +', '+ e.pageY);
$('#iconParent').css("height",e.pageY+2);
$('#documentViewer').css("height",(600-(e.pageY+30)));
$(document).unbind('mousemove');
});
}
});
You can make use of jQuery UI for something like this. It supports resizing of certain items. You can find the example here. Although this is on the element itself and not another element. But you could do it like this: