-
Notifications
You must be signed in to change notification settings - Fork 54
/
borderlayout-resize-nested.html
executable file
·126 lines (114 loc) · 3.1 KB
/
borderlayout-resize-nested.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<!doctype html>
<html>
<head>
<title>Resizing Border Layout example</title>
<meta charset="utf-8">
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/ui-lightness/jquery-ui.css" rel="stylesheet" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script type="text/javascript" src="../lib/jquery.sizes.js"></script>
<script type="text/javascript" src="../lib/jlayout.border.js"></script>
<script type="text/javascript" src="../lib/jquery.jlayout.js"></script>
<script type="text/javascript">
jQuery(function($) {
// Just call the inner layout once to initialize it. This
// must happen before the outer layout is initialized. It
// will be automatically resized when the outer layout is
// resized.
$('.layout-inner').layout();
var outerContainer = $('.layout-outer');
function layout() {
outerContainer.layout({resize: false});
}
layout();
$(window).resize(layout);
// This selector is changed to only select the west and east
// components of the outer layout.
$('.layout-outer > .east').resizable({
handles: 'w',
stop: layout
});
$('.layout-outer > .west').resizable({
handles: 'e',
stop: layout
});
});
</script>
<style>
html, body {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
overflow: hidden;
}
.layout-outer {
height: 100%;
}
.center, .east, .west, .north, .south {
background-color: rgb(220,220,220);
border: 1px solid rgb(200,200,200);
text-align: center;
display: inline-block;
}
.west, .east {
width: 8%;
}
.north, .south {
height: 10%;
}
/**
* To get correct percentages widths and heights in the inner layout
* you have to set the container to take up all space that's left after
* the outer columns east, west, north and south components. In this case:
* width = 100% - 8% - 8% = 84%
* height = 100% - 10% - 10% = 80%
*/
.layout-inner {
width: 84%;
height: 80%;
background-color: white;
border: 0px;
}
.layout-inner .west, .layout-inner .east {
width: 25%;
}
.layout-inner .south, .layout-inner .north {
height: 20%;
}
</style>
</head>
<body>
<div data-layout='{"type": "border", "hgap": 3, "vgap": 3}' class="layout-outer">
<div data-layout='{"type": "border", "hgap": 3, "vgap": 3}' class="center layout-inner">
<div class="center">
inner center
</div>
<div class="east">
inner East
</div>
<div class="west">
inner West
</div>
<div class="north">
inner North
</div>
<div class="south">
inner South
</div>
</div>
<div class="east">
East
</div>
<div class="west">
West
</div>
<div class="north">
North
</div>
<div class="south">
South
</div>
</div>
</body>
</html>