-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
76 lines (76 loc) · 1.88 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
72
73
74
75
76
<style>
html, body {
margin: 0;
}
div {
text-align: center;
font-family: sans-serif;
}
#page {
height: 100%;
display: flex;
flex-direction: column;
}
#content {
flex-grow: 1;
height: 100%;
width: 100%;
position: relative;
}
#wrapper {
top: 0;
right: 0;
left: 0;
bottom: 0;
position: absolute;
margin: 8px;
}
#image {
display: block;
position: absolute;
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#nav {
display: none;
position: absolute;
margin-top: 8px;
}
.padded {
background-color: black;
color: white;
padding: 8px;
}
</style>
<body>
<div id="page">
<div id="header"><div class="padded">HEADER HEADER HEADER</div></div>
<div id="content">
<div id="wrapper">
<img id="image" src="https://via.placeholder.com/600x800.png" />
<div id="nav"><div class="padded">NAVIGATION</div></div>
</div>
</div>
<div id="footer"><div class="padded">FOOTER FOOTER FOOTER<br />MORE FOOTER</div></div>
</div>
<script>
wrapper = document.getElementById("wrapper");
image = document.getElementById("image");
nav = document.getElementById("nav");
reposition = function() {
nav.style.top = image.offsetTop + image.offsetHeight / 2;
nav.style.left = nav.style.right = image.offsetLeft - image.offsetWidth / 2;
};
window.addEventListener("resize", reposition);
image.addEventListener("load", function() {
nav.style.display = "unset";
wrapper.style.marginBottom = 16 + nav.offsetHeight + "px";
reposition();
});
</script>
</body>