Line | |
---|
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 scrolling settings
|
---|
9 | document.body.style.margin = "0px";
|
---|
10 | document.body.style.overflow = "hidden";
|
---|
11 | this.scrollingRegion.style.overflow = "auto";
|
---|
12 |
|
---|
13 | // fix the size of the scrolling region
|
---|
14 | this.resize(null);
|
---|
15 |
|
---|
16 | // add an event handler to resize the scrolling region when the window is resized
|
---|
17 | registerEventHandler(window, 'resize', getInstanceDelegate(this, "resize"));
|
---|
18 |
|
---|
19 | }
|
---|
20 |
|
---|
21 | SplitScreen.prototype.resize = function(e) {
|
---|
22 | var height = document.body.clientHeight - this.nonScrollingRegion.offsetHeight;
|
---|
23 | if (height > 0) {
|
---|
24 | this.scrollingRegion.style.height = height;
|
---|
25 | } else {
|
---|
26 | this.scrollingRegion.style.height = 0;
|
---|
27 | }
|
---|
28 | this.scrollingRegion.style.width = document.body.clientWidth;
|
---|
29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.