-
Notifications
You must be signed in to change notification settings - Fork 29
/
index.html
71 lines (60 loc) · 1.84 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<!--
This website was carefully constructed by
Interactive Studios
http://www.interactivestudios.nl
-->
<title>FlexVerticalCenter test</title>
<style>
body{
margin: 0;
}
.box {
background: #333;
height: 300px;
margin-bottom: 30px;
}
.box2 {
background: #ccc;
height: 100px;
}
p {
width: 20%;
margin: 0 auto;
color: #fff;
font-weight: bold;
}
</style>
</head>
<body>
<div class="box">
<p class="first-item">
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).
</p>
</div>
<div class="box">
<p class="second-item">
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).
</p>
</div>
<div class="box parent">
<div class="box2">
<p class="third-item">
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).
</p>
</div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="jquery.flexverticalcenter.js"></script>
<script>
$('.first-item').flexVerticalCenter({ cssAttribute: 'padding-top' });
$('.second-item').flexVerticalCenter({ cssAttribute: 'padding-top', verticalOffset: '50px' });
$('.third-item').flexVerticalCenter({ cssAttribute: 'padding-top', parentSelector: '.parent' });
</script>
</body>
</html>