PageRenderTime 11ms CodeModel.GetById 7ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Documentation/Help/scripts/SplitScreen.js

#
JavaScript | 35 lines | 18 code | 12 blank | 5 comment | 3 complexity | 92bc48ef6e57b68262f336747bf80134 MD5 | raw file
 1
 2	function SplitScreen (nonScrollingRegionId, scrollingRegionId) {
 3
 4		// store references to the two regions
 5		this.nonScrollingRegion = document.getElementById(nonScrollingRegionId);
 6		this.scrollingRegion = document.getElementById(scrollingRegionId);
 7
 8        // set the position model for each region
 9		this.nonScrollingRegion.style.position = "fixed";
10		this.scrollingRegion.style.position = "absolute";
11
12		// fix the size of the scrolling region
13		this.resize(null);
14
15		// add an event handler to resize the scrolling region when the window is resized		
16		registerEventHandler(window, 'resize', getInstanceDelegate(this, "resize"));
17
18	}
19
20	SplitScreen.prototype.resize = function(e) {
21
22		if(navigator.userAgent.indexOf("Firefox")==-1)
23  		{	
24			var height = document.body.clientHeight - this.nonScrollingRegion.offsetHeight;
25
26			if(height > 0) this.scrollingRegion.style.height = height + "px";
27			else this.scrollingRegion.style.height = 0 + "px";
28
29			this.scrollingRegion.style.width = document.body.clientWidth + "px";
30		}
31
32	
33        // update the vertical offset of the scrolling region to account for the height of the non-scrolling region
34        this.scrollingRegion.style.top = this.nonScrollingRegion.offsetHeight + "px";
35	}