js fit window to content

Solutions on MaxInterview for js fit window to content by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "js fit window to content"
Mads
03 Jan 2018
1/* fit the window size to match the content wrapper */
2function fitWindow2Content( contentWrapper ) {
3  
4	// calculate necessary change in window's width
5	var width = window.innerWidth - contentWrapper.clientWidth;
6
7	// calculate necessary change in window's height
8	var height = window.innerHeight- contentWrapper.clientHeight;
9  
10  	// resize window to fit content
11	window.resizeBy( -width , -height );
12
13}