Consider the following simple html page:
<doctype>
<html>
<head>
<title>This is my page</title>
<script type="text/javascript" src="jquery-1.8.3.min.js"></script>
</head>
<body style="padding:0px;margin:0px">
<div id="root" style="background-color:#dddddd;width:100px;height:100px;position:relative">
<div id="graph" style="background-color:#00ff00;width:200px;height:200px;position:absolute;bottom:0px">
This is the DW box
</div>
</div>
<script type="text/javascript">
$(window).resize(function(){
$('#root').width($(window).width());
$('#root').height($(window).height());
});
</script>
</body>
</html>
As you can see by using jQuery
I resize div root
in order to fit the window. If you try the code (at least on Chrome, my version is Chrome 23) what happens is that root
will constantly fit the browser window horizontally. Vertically fitting is also performed correctly but only when incrementing browser's window height.
If you try to expand your browser window vertically, no problem. But, after expanding, if you try to reduce the vertical seize of your browser window, root
will not fit it!
Demo
You can see my window here.
Here I expand, nothing wrong, the grey box (root) expands.
Unfortunately the snapshot tool does not show the scrollbar but it is evident that when reducing the vertical size, the grey box does not fit...
Why is this? How to fix this? Thankyou
PS
You see a div named graph
. That div is supposed to stay in the lower part of the browser window.