Set width to div in real time
<div id= "Detail" style= "width:100%; Overflow:scroll; " >
</div>
<script type= "Text/javascript" >
var winwidth = 0;
var winheight = 0;
function finddimensions ()//functions: Getting dimensions
{
Get window width
if (window.innerwidth)
Winwidth = window.innerwidth;
else if ((document.body) && (document.body.clientWidth))
Winwidth = Document.body.clientWidth;
Get window Height
if (window.innerheight)
Winheight = Window.innerheight;
else if ((document.body) && (document.body.clientHeight))
Winheight = Document.body.clientHeight;
Get the window size by examining the body inside the document
if (document.documentelement && document.documentElement.clientHeight && Document.documentElement.clientWidth) {
Winheight = Document.documentElement.clientHeight;
Winwidth = Document.documentElement.clientWidth;
}
Assign a value with div
var detail = document.getElementById ("detail");
Detail.style.width = winWidth-4;
}
Finddimensions ();
Call a function to get a value
Window.onresize = finddimensions;
</script>
JS Real-time Get browser window size.