-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcarousel.html
More file actions
executable file
·241 lines (192 loc) · 5.87 KB
/
carousel.html
File metadata and controls
executable file
·241 lines (192 loc) · 5.87 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<title>Carousel Layout</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/normalize.min.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="https://eaa-3imd-2017.github.io/header-generique/header-generique.css">
<style>
body {
background: #ddd;
display: flex;
flex-direction: column;
}
#nav-projets {
z-index: 99;
}
.cadre {
overflow-x: hidden;
position: relative;
border: 0px solid blue;
height: calc(100vh - 7.6rem);
height: 100vh;
}
.navigation {
position: absolute;
z-index: 10;
width: 100%;
top: 3rem;
}
.navigation ol {
background: #A3A3A3;
width: 25rem;
margin: 0 auto;
padding: 0.5rem 3rem;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
text-align: center;
}
.navigation li {
display: block;
margin: 0;
list-style: none;
}
.navigation a {
font: 0/0 a;
text-shadow: none;
display: block;
width: 1rem;
height: 1rem;
border-radius: 50%;
background: #fff;
}
.cadre section {
position: absolute;
padding: 5em 1em 1em 1em;
top: 1em;
left: 1em;
width: calc(100% - 2em);
height: calc(100% - 2em);
background: #EAA1A1;
}
.cadre section:nth-of-type(1n+2) {
opacity: 0;
}
footer {
position: relative;
background: #999;
width: 100%;
padding: 0.5em;
}
.newpage {
animation-name: fadein;
animation-duration: 1s;
animation-iteration-count: 1;
animation-fill-mode: both;
}
.prevpage {
animation-name: fadeout;
animation-duration: 1s;
animation-iteration-count: 1;
animation-fill-mode: both;
}
.cadre .firstpage {
z-index: 1;
opacity: 1;
}
@keyframes fadein {
0% {
opacity: 0;
z-index: 5;
}
100% {
opacity: 1;
}
}
@keyframes fadeout {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
</style>
</head>
<body>
<nav id="nav-projets"></nav>
<main class="cadre">
<nav class="navigation">
<ol>
<li><a href="#page-1">Page 1</a></li>
<li><a href="#page-2">Page 2</a></li>
<li><a href="#page-3">Page 3</a></li>
<li><a href="#page-4">Page 4</a></li>
<li><a href="#page-5">Page 5</a></li>
<li><a href="#page-6">Page 6</a></li>
</ol>
</nav>
<section id="page-1" class="newpage firstpage">
<h2>page 1</h2>
<p>Pellentesque efficitur elit blandit, suscipit ligula sed, elementum magna. Praesent metus magna, posuere id consectetur sit amet, convallis eu urna. Suspendisse pulvinar eros quis imperdiet porta. Nunc condimentum eros ac eros luctus ultricies. Nam libero nunc, iaculis vitae pulvinar et, sollicitudin vel massa. Vivamus lorem lorem, accumsan ut massa quis, venenatis ornare eros. Nam tincidunt eget orci sit amet eleifend. Suspendisse at tincidunt enim, molestie dictum purus.</p>
</section>
<section id="page-2">
<h2>page 2</h2>
<p>Pellentesque efficitur elit blandit, suscipit ligula sed, elementum magna. Praesent metus magna, posuere id consectetur sit amet, convallis eu urna. Suspendisse pulvinar eros quis imperdiet porta. Nunc condimentum eros ac eros luctus ultricies.</p>
</section>
<section id="page-3">
<h2>page 3</h2>
<p>Nam libero nunc, iaculis vitae pulvinar et, sollicitudin vel massa. Vivamus lorem lorem, accumsan ut massa quis, venenatis ornare eros. Nam tincidunt eget orci sit amet eleifend. Suspendisse at tincidunt enim, molestie dictum purus.</p>
</section>
<section id="page-4">
<h2>page 4</h2>
<p>Pellentesque efficitur elit blandit, suscipit ligula sed, elementum magna. Praesent metus magna, posuere id consectetur sit amet, convallis eu urna.</p>
</section>
<section id="page-5">
<h2>page 5</h2>
<p>Vivamus lorem lorem, accumsan ut massa quis, venenatis ornare eros. Nam tincidunt eget orci sit amet eleifend. Suspendisse at tincidunt enim, molestie dictum purus.</p>
</section>
<section id="page-6">
<h2>page 6</h2>
<p>Suspendisse at tincidunt enim, molestie dictum purus.</p>
</section>
</main>
<footer>
<small>contenu pied de page</small>
</footer>
<script>
// Navigation d'une section à l'autre
window.addEventListener("load", NavigateSections, false);
function NavigateSections() {
var navItems = document.querySelectorAll(".navigation a");
var i;
for (i = 0; i < navItems.length; i++) {
navItems[i].addEventListener(
"click", LoadSection, false
);
}
};
function LoadSection(event) {
var target = this.getAttribute("href");
// resultat : #page-4
// supprimer le "#""
target = target.substring(1);
// masquer les pages anciennes :
var ForgetPage = document.querySelector(".prevpage");
if (ForgetPage) {
ForgetPage.style.zIndex = 1;
ForgetPage.style.opacity = 0;
ForgetPage.className = "";
}
// garder visible la page précédente :
var PrevPage = document.querySelector(".newpage");
if (PrevPage) {
PrevPage.style.zIndex = 4;
PrevPage.className = "prevpage";
}
// faire apparaitre la nouvelle page:
var NewPage = document.getElementById(target);
if (NewPage) {
NewPage.style.zIndex = 5;
NewPage.className = "newpage";
}
event.preventDefault();
}
</script>
<script src='https://eaa-3imd-2017.github.io/header-generique/header-generique.js'></script>
</body>
</html>