fit window to content javascript code example
Example: js fit window to content
/* fit the window size to match the content wrapper */
function fitWindow2Content( contentWrapper ) {
// calculate necessary change in window's width
var width = window.innerWidth - contentWrapper.clientWidth;
// calculate necessary change in window's height
var height = window.innerHeight- contentWrapper.clientHeight;
// resize window to fit content
window.resizeBy( -width , -height );
}