equal
deleted
inserted
replaced
20 this.middle = $('#' + middleId); |
20 this.middle = $('#' + middleId); |
21 this.middleContainer = $(this.middle).parent(); |
21 this.middleContainer = $(this.middle).parent(); |
22 if (bottomId != null) { |
22 if (bottomId != null) { |
23 this.bottom = $('#' + bottomId); |
23 this.bottom = $('#' + bottomId); |
24 } |
24 } |
25 this.footer = $('#' + footerId); |
25 if (footerId != null) { |
|
26 this.footer = $('#' + footerId); |
|
27 } |
26 this.minTopBottomHeight = minTopBottomHeight; |
28 this.minTopBottomHeight = minTopBottomHeight; |
27 this.ratio = ratio; |
29 this.ratio = ratio; |
28 this.preMiddleSizeFunc = preMiddleSizeFunc; |
30 this.preMiddleSizeFunc = preMiddleSizeFunc; |
29 this.postMiddleSizeFunc = postMiddleSizeFunc; |
31 this.postMiddleSizeFunc = postMiddleSizeFunc; |
30 |
32 |
37 this.resizeElements = function() |
39 this.resizeElements = function() |
38 { |
40 { |
39 var self = incResize; |
41 var self = incResize; |
40 |
42 |
41 // Compute maximun middle element height |
43 // Compute maximun middle element height |
42 var heightForTopMiddleBotom = $(self.content).height() - $(self.footer).height() - 70; |
44 var heightForTopMiddleBotom = $(self.content).height() - 70; |
|
45 if (self.footer !== undefined) { |
|
46 heightForTopMiddleBotom -= $(self.footer).height() |
|
47 } |
43 var maxMiddleHeight = heightForTopMiddleBotom - self.minTopBottomHeight * 2; |
48 var maxMiddleHeight = heightForTopMiddleBotom - self.minTopBottomHeight * 2; |
44 |
49 |
45 // Get the middle element parent width nad test if it is not to big (to let place for top and bottom without adding scroll bars) |
50 // Get the middle element parent width and test if it is not to big (to let place for top and bottom without adding scroll bars) |
46 var middleRatio = 1 / self.ratio; |
51 var middleRatio = 1 / self.ratio; |
47 var newMiddleWidth = $(self.middleContainer).width(); |
52 var newMiddleWidth = $(self.middleContainer).width(); |
48 var newMiddleHeight = newMiddleWidth * middleRatio; |
53 var newMiddleHeight = newMiddleWidth * middleRatio; |
49 |
54 |
50 /* |
55 /* |
78 } |
83 } |
79 |
84 |
80 // Change top and bottom heights |
85 // Change top and bottom heights |
81 if (this.top != undefined && this.bottom != undefined) { |
86 if (this.top != undefined && this.bottom != undefined) { |
82 // Get the full height and compute heigth for top and bottom |
87 // Get the full height and compute heigth for top and bottom |
83 var remainingHeight = $(self.content).height() - $(self.footer).height() - newMiddleHeight - 70; |
88 var remainingHeight = heightForTopMiddleBotom - newMiddleHeight; |
84 var newOtherHeight = remainingHeight / 2.0; |
89 var newOtherHeight = remainingHeight / 2.0; |
85 if (newOtherHeight < self.minTopBottomHeight) { |
90 if (newOtherHeight < self.minTopBottomHeight) { |
86 newOtherHeight = self.minTopBottomHeight; |
91 newOtherHeight = self.minTopBottomHeight; |
87 } |
92 } |
88 $(self.top).css({"height" : +newOtherHeight+'px', "lineHeight" : +newOtherHeight+'px'}); |
93 $(self.top).css({"height" : +newOtherHeight+'px', "lineHeight" : +newOtherHeight+'px'}); |
89 $(self.bottom).css({"height" : +newOtherHeight+'px', "lineHeight" : +newOtherHeight+'px'}); |
94 $(self.bottom).css({"height" : +newOtherHeight+'px', "lineHeight" : +newOtherHeight+'px'}); |
90 } |
95 } |
91 } |
96 }; |
92 } |
97 } |
93 |
98 |
94 var incResize = new IncResize(); |
99 var incResize = new IncResize(); |
95 |
100 |
96 |
101 |