Skip to content

Commit a9d4ab4

Browse files
committed
updated test index.html to demonstrate new verticalOffset and parentSelector options
1 parent 8603bd8 commit a9d4ab4

File tree

1 file changed

+42
-32
lines changed

1 file changed

+42
-32
lines changed

index.html

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,71 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22

3-
<html lang="nl">
3+
<html>
44

55
<head>
66
<meta charset="utf-8">
77
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
8-
9-
<!--
8+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
9+
10+
<!--
1011
This website was carefully constructed by
1112
Interactive Studios
1213
http://www.interactivestudios.nl
1314
-->
14-
15+
1516
<title>FlexVerticalCenter test</title>
16-
17-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
18-
19-
<style type="text/css">
20-
/* make sure we have a very flexible container */
17+
18+
<style>
2119
body{
2220
margin: 0;
23-
height: 100%;
24-
}
25-
html{
26-
height: 100%;
2721
}
28-
29-
.the-item{
30-
width: 20%;
31-
background: #eee;
32-
margin: 0 auto;
22+
.box {
23+
background: #333;
24+
height: 300px;
25+
margin-bottom: 30px;
3326
}
34-
img{
35-
max-width: 100%;
27+
.box2 {
28+
background: #ccc;
29+
height: 100px;
3630
}
31+
p {
32+
width: 20%;
33+
margin: 0 auto;
34+
color: #fff;
35+
font-weight: bold;
36+
}
3737
</style>
38-
3938
</head>
4039

41-
4240
<body>
41+
<div class="box">
42+
<p class="first-item">
43+
This box is 20% wide and is always vertically centered within its parent, even if the view port changes (resize your window to see the result).
44+
</p>
45+
</div>
4346

44-
<div class="the-item">
45-
<p>
46-
This box is 20% wide and is always vertically centered within it's parent, even if the view port changes (resize your window to see the result).
47+
<div class="box">
48+
<p class="second-item">
49+
This box is 20% wide and is always vertically centered within its parent with a -50px offset, even if the view port changes (resize your window to see the result).
4750
</p>
4851
</div>
49-
50-
52+
53+
<div class="box parent">
54+
<div class="box2">
55+
<p class="third-item">
56+
This box is 20% wide and is always vertically centered within the specified dark grey parent, even if the view port changes (resize your window to see the result).
57+
</p>
58+
</div>
59+
</div>
60+
5161
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
5262
<script src="jquery.flexverticalcenter.js"></script>
5363

5464
<script>
55-
$('.the-item').flexVerticalCenter();
65+
$('.first-item').flexVerticalCenter('padding-top');
66+
$('.second-item').flexVerticalCenter('padding-top', { verticalOffset: '50px' });
67+
$('.third-item').flexVerticalCenter('padding-top', { parentSelector: '.parent' });
5668
</script>
57-
58-
5969
</body>
6070

61-
</html>
71+
</html>

0 commit comments

Comments
 (0)