-
Notifications
You must be signed in to change notification settings - Fork 1
/
carousel-vertical.html
executable file
·308 lines (243 loc) · 5.83 KB
/
carousel-vertical.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
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
<!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;
font-family: "Avenir Next", sans-serif;
}
#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;
top: 0;
left: 0;
height: 100vh;
}
.navigation ol {
background: #A3A3A3;
width: 3rem;
height: 100%;
margin: 0;
padding: 25vh 0.5rem;
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: column;
}
@media only screen and (min-width: 40em) {
.navigation {
left: calc(50% - 1.5rem);
}
}
.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: 0;
top: 1em;
left: 1em;
width: calc(100% - 2em);
height: calc(100% - 2em);
background: #EAA1A1;
display: flex;
flex-direction: column;
}
@media only screen and (min-width: 40em) {
.cadre section {
flex-direction: row;
}
}
.cadre section:nth-of-type(1n+2) {
opacity: 0;
}
.cadre h2 {
position: absolute;
top: 3em;
left: 3em;
}
.cadre p {
background: lightgreen;
flex: 1 1 auto;
display: flex;
flex-direction: column;
text-align: center;
justify-content: center;
font-size: 10em;
margin: 0;
color: #EAA1A1;
}
.cadre p:nth-child(even) {
background: transparent;
color: lightgreen;
}
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>A</p>
<p>B</p>
</section>
<section id="page-2">
<h2>page 2</h2>
<p>C</p>
<p>D</p>
</section>
<section id="page-3">
<h2>page 3</h2>
<p>E</p>
<p>F</p>
</section>
<section id="page-4">
<h2>page 4</h2>
<p>G</p>
<p>H</p>
</section>
<section id="page-5">
<h2>page 5</h2>
<p>I</p>
<p>J</p>
</section>
<section id="page-6">
<h2>page 6</h2>
<p>K</p>
<p>L</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
);
}
// document.querySelector(".cadre").addEventListener(
// "click", Onscrollfnction, false
// );
};
function LoadSection(event) {
var navItems = document.querySelectorAll(".navigation a");
// coloriser en blanc tous les liens
for (i = 0; i < navItems.length; i++) {
navItems[i].style.backgroundColor = "#fff";
}
// coloriser en rouge le lien qu'on vient de cliquer
this.style.backgroundColor = "lightgreen";
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>