-
Notifications
You must be signed in to change notification settings - Fork 54
/
borderlayout-resize-smooth.html
executable file
·129 lines (113 loc) · 3.36 KB
/
borderlayout-resize-smooth.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
127
128
129
<!doctype 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($)
{
var container = $('.layout');
function layout() {
container.layout({resize: false, type: 'border', vgap: 8, hgap: 8});
}
$('.north').resizable({
handles: 's',
stop: layout,
resize: layout
});
$('.south').resizable({
handles: 'n',
stop: layout,
resize: layout
});
$('.east').resizable({
handles: 'w',
stop: layout,
resize: layout
});
$('.west').resizable({
handles: 'e',
stop: layout,
resize: layout
});
$(window).resize(layout);
layout();
layout();
});
</script>
<style>
html, body {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
overflow: hidden;
}
.layout {
height: 100%;
background-color: rgb(220, 220, 220);
}
.center, .east, .west, .north, .south {
background-color: white;
border: 1px solid rgb(200, 200, 200);
text-align: center;
display: inline-block;
padding: 1em;
}
p {
text-align: left;
}
.west, .east {
width: 8%;
}
.north, .south {
height: 10%;
}
/**
* These styles are to create custom resize handles.
*/
.ui-resizable-w {
left: -8px;
width: 8px;
}
.ui-resizable-e {
right: -8px;
width: 8px;
}
.ui-resizable-n {
top: -8px;
height: 8px;
}
.ui-resizable-s {
bottom: -8px;
height: 8px;
}
</style>
</head>
<body>
<div class="layout">
<div class="center">
Center
<h1><a href="http://www.bramstein.com/projects/jlayout/">jLayout project homepage</a></h1>
<p>This example uses the <code>resize</code> callback on the jQuery UI resizable "widget" to resize the layout while dragging the borders. Combined with some custom CSS rules, this makes for a very elegant resizable border layout. Please take care while using the <code>resize</code> event handler as recalculating the layout every pixel is expensive and older browsers might not have smooth resizing as a result.</p>
</div>
<div class="east">
East
</div>
<div class="west">
West
</div>
<div class="north">
North
</div>
<div class="south">
South
</div>
</div>
</body>
</html>