Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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 );

}
 
PREVIOUS NEXT
Tagged: #js #fit #window #content
ADD COMMENT
Topic
Name
4+5 =