-
Notifications
You must be signed in to change notification settings - Fork 0
/
parallaxEffect07.html
569 lines (537 loc) · 23.7 KB
/
parallaxEffect07.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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>패럴랙스 이펙트07</title>
<link rel="stylesheet" href="../assets/css/parallax.css">
<link rel="stylesheet" href="../assets/css/dracula.css">
<link href="https://webfontworld.github.io/NexonLv1Gothic/NexonLv1Gothic.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Lato:wght@100&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@900&display=swap" rel="stylesheet">
<style>
/* parallaxType */
#parallax__nav {
position: fixed;
right: 20px;
top: 20px;
z-index: 2000;
background-color: rgba(0,0,0,0.4);
padding: 20px 30px;
border-radius: 50px;
transition: top .4s ease;
}
#parallax__nav li {
display: inline;
margin: 0 5px;
}
#parallax__nav li a {
display: inline-block;
height: 30px;
padding: 5px 20px;
text-align: center;
line-height: 30px;
}
#parallax__nav li.active a {
background: #fff;
color: #000;
border-radius: 20px;
box-sizing: content-box;
}
/* parallax__cont */
#parallax__cont {
max-width: 1600px;
width: 98%;
margin: 0 auto;
/* background-color: rgba(255,255,255,0.1); */
}
.content__item {
width: 1000px;
max-width: 70vw;
margin: 30vw auto;
/* background-color: rgba(255,255,255,0.3); */
text-align: left;
margin-right: 0;
position: relative;
padding-top: 7vw;
}
/* even(짝수), 2n, 2n+1, 2n*8 등 입력 가능 */
.content__item:nth-child(even){
margin-left: 0;
text-align: right;
}
.content__item__num {
font-size: 35vw;
font-family: 'Lato';
font-weight: 100;
position: absolute;
left: -5vw;
top: -16vw;
opacity: 0.07;
z-index: -2;
}
.content__item:nth-child(even) .content__item__num {
/* left값 초기화 후 right 값 설정 */
left: auto;
right: -5vw;
}
.content__item__title {
font-weight: 400;
text-transform: capitalize;
}
.content__item__imgWrap {
width: 100%;
padding-bottom: 56.25%;
position: relative;
overflow: hidden;
z-index: -1;
}
.content__item__img {
position: absolute;
width: 110%;
height: 110%;
background: url(../assets/img/effect_bg01-min.jpg);
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
left: -5%;
top: -5%;
filter: saturate(0%);
/* transition: all 1s; */
}
.content__item:nth-child(1) .content__item__img {
background-image: url(../assets/img/effect_bg01-min.jpg);
}
.content__item:nth-child(2) .content__item__img {
background-image: url(../assets/img/effect_bg02-min.jpg);
}
.content__item:nth-child(3) .content__item__img {
background-image: url(../assets/img/effect_bg03-min.jpg);
}
.content__item:nth-child(4) .content__item__img {
background-image: url(../assets/img/effect_bg04-min.jpg);
}
.content__item:nth-child(5) .content__item__img {
background-image: url(../assets/img/effect_bg05-min.jpg);
}
.content__item:nth-child(6) .content__item__img {
background-image: url(../assets/img/effect_bg06-min.jpg);
}
.content__item:nth-child(7) .content__item__img {
background-image: url(../assets/img/effect_bg07-min.jpg);
}
.content__item:nth-child(8) .content__item__img {
background-image: url(../assets/img/effect_bg08-min.jpg);
}
.content__item:nth-child(9) .content__item__img {
background-image: url(../assets/img/effect_bg09-min.jpg);
}
.content__item__desc {
font-size: 4vw;
line-height: 1.4;
margin-top: -5vw;
margin-left: -4vw;
word-break: keep-all;
}
.content__item:nth-child(even) .content__item__desc {
margin-left: auto;
margin-right: -4vw;
}
/* parallax__info */
#parallax__info {
position: fixed;
left: 20px;
bottom: 20px;
z-index: 2000px;
background: rgba(0,0,0,0.6);
color: #fff;
padding: 20px;
border-radius: 10px;
}
#parallax__info li, .scrollTop {
line-height: 1.4;
}
@media (max-width: 800px) {
#parallax__cont {
margin-top: 70vw;
}
#parallax__nav {
padding: 10px;
right: auto;
left: 10px;
top: 50%;
transform: translateY(-50%);
border-radius: 5px;
background-color: rgba(0,0,0,0.8);
}
#parallax__nav li {
display: block;
margin: 5px;
}
#parallax__nav li a {
font-size: 14px;
padding: 5px;
border-radius: 5px;
height: auto;
line-height: 1;
}
#parallax__nav li.active a {
border-radius: 5px;
}
}
/* option */
.reveal > div,
.reveal > span {
opacity: 0;
}
.reveal.show > div,
.reveal.show > span {
animation: opacity 1s linear forwards;
}
.reveal {
position: relative;
}
.reveal::before {
position: absolute;
content: '';
left: 0;
top: 0;
width: 0;
height: 100%;
background: #999;
z-index: 1;
}
.reveal.reveal-TWO::after {
position: absolute;
content: '';
left: 0;
top: 0;
width: 0;
height: 100%;
z-index: 1;
background: #000;
}
/* reveal-ONE */
.reveal.show::before {
animation: reveal 1s;
}
.reveal-RTL.show::before {
animation: reveal-RTL 1s;
}
.reveal-TTB.show::before {
animation: reveal-TTB 1s;
}
.reveal-BTT.show::before {
animation: reveal-BTT 1s;
}
/* reveal-TWO */
.reveal.show::after {
animation: reveal 1s 0.3s;
}
.reveal.reveal-RTL.show::after {
animation: reveal-RTL 1s 0.3s;
}
.reveal.reveal-TTB.show::after {
animation: reveal-TTB 1s 0.3s;
}
.reveal.reveal-BTT.show::after {
animation: reveal-BTT 1s 0.3s;
}
.content__item__num,
.content__item__title {
display: none;
}
@keyframes opacity {
0% {opacity: 0;}
60% {opacity: 0;}
70% {opacity: 1;}
100% {opacity: 1;}
}
@keyframes reveal {
0% {width: 0; left: 0;}
50% {width: 100%; left: 0;}
80% {width: 100%; left: 0;}
100% {width: 0; left: 100%;}
}
@keyframes reveal-RTL {
0% {width: 0; right: 0; left: auto;}
50% {width: 100%; right: 0; left: auto;}
80% {width: 100%; right: 0; left: auto;}
100% {width: 0; right: 100%; left: auto;}
}
@keyframes reveal-TTB {
0% {width: 100%; height: 0; top: 0;}
50% {width: 100%; height: 100%; top: 0;}
80% {width: 100%; height: 100%; top: 0;}
100% {width: 100%; height: 0; top: 100%;}
}
@keyframes reveal-BTT {
0% {width: 100%; height: 0; bottom: 0; top: auto;}
50% {width: 100%; height: 100%; bottom: 0; top: auto;}
80% {width: 100%; height: 100%; bottom: 0; top: auto;}
100% {width: 100%; height: 0; bottom: 100%; top: auto;}
}
</style>
</head>
<body class="img11">
<header id="header">
<h1><a href="parallaxEffect.html">Javascript Parallax Effect07</a></h1>
<p>패럴랙스 이펙트 - 리빌 효과</p>
<ul>
<li><a href="parallaxEffect01.html">1</a></li>
<li><a href="parallaxEffect02.html">2</a></li>
<li><a href="parallaxEffect03.html">3</a></li>
<li><a href="parallaxEffect04.html">4</a></li>
<li><a href="parallaxEffect05.html">5</a></li>
<li><a href="parallaxEffect06.html">6</a></li>
<li class="active"><a href="parallaxEffect07.html">7</a></li>
</ul>
</header>
<!-- //header -->
<main id="parallax__cont">
<div id="contents">
<section id="section1" class="content__item">
<span class="content__item__num">01</span>
<h2 class="content__item__title">section1</h2>
<figure class="content__item__imgWrap reveal">
<div class="content__item__img"></div>
</figure>
<p class="content__item__desc split reveal">우선 무엇이 되고자 하는가를 자신에게 말하라 그리고 해야 할일을 하라.</p>
</section>
<!-- //section1 -->
<section id="section2" class="content__item">
<span class="content__item__num">02</span>
<h2 class="content__item__title">section2</h2>
<figure class="content__item__imgWrap reveal reveal-RTL">
<div class="content__item__img"></div>
</figure>
<p class="content__item__desc split reveal reveal-RTL" data-delay="500">이미 끝나버린 일을 후회하기 보다는 하고 싶었던 일들을 하지 못한 것을 후회하라.</p>
</section>
<!-- //section2 -->
<section id="section3" class="content__item">
<span class="content__item__num">03</span>
<h2 class="content__item__title">section3</h2>
<figure class="content__item__imgWrap reveal reveal-TTB">
<div class="content__item__img"></div>
</figure>
<p class="content__item__desc split reveal reveal-TTB" data-delay="500">문제는 목적지에 얼마나 빨리 가느냐가 아니라 그 목적지가 어디냐는 것이다.</p>
</section>
<!-- //section3 -->
<section id="section4" class="content__item">
<span class="content__item__num">04</span>
<h2 class="content__item__title">section4</h2>
<figure class="content__item__imgWrap reveal reveal-TWO" data-delay="1500">
<div class="content__item__img"></div>
</figure>
<p class="content__item__desc split reveal reveal-TWO">도저히 손댈 수가 없는 곤란에 부딪혔다면 과감하게 그 속으로 뛰어들라.</p>
</section>
<!-- //section4 -->
<section id="section5" class="content__item">
<span class="content__item__num">05</span>
<h2 class="content__item__title">section5</h2>
<figure class="content__item__imgWrap reveal reveal-TWO reveal-RTL">
<div class="content__item__img"></div>
</figure>
<p class="content__item__desc split reveal reveal-TWO reveal-RTL">당신이 할수 있다고 믿든 할수 없다고 믿든 믿는 대로 될것이다.</p>
</section>
<!-- //section5 -->
<section id="section6" class="content__item">
<span class="content__item__num">06</span>
<h2 class="content__item__title">section6</h2>
<figure class="content__item__imgWrap reveal reveal-TWO reveal-TTB">
<div class="content__item__img"></div>
</figure>
<p class="content__item__desc split reveal reveal-TWO reveal-TTB">마음만을 가지고 있어서는 안된다. 반드시 실천하여야 한다.</p>
</section>
<!-- //section6 -->
<section id="section7" class="content__item">
<span class="content__item__num">07</span>
<h2 class="content__item__title">section7</h2>
<figure class="content__item__imgWrap reveal reveal-TWO reveal-BTT">
<div class="content__item__img"></div>
</figure>
<p class="content__item__desc split reveal reveal-TWO reveal-BTT">꿈을 계속 간직하고 있으면 반드시 실현할 때가 온다.</p>
</section>
<!-- //section7 -->
<section id="section8" class="content__item">
<span class="content__item__num">08</span>
<h2 class="content__item__title">section8</h2>
<figure class="content__item__imgWrap reveal">
<div class="content__item__img"></div>
</figure>
<p class="content__item__desc split reveal">오랫동안 꿈을 그리는 사람은 마침내 그 꿈을 닮아 간다.</p>
</section>
<!-- //section8 -->
<section id="section9" class="content__item">
<span class="content__item__num">09</span>
<h2 class="content__item__title">section9</h2>
<figure class="content__item__imgWrap reveal reveal-RTL">
<div class="content__item__img"></div>
</figure>
<p class="content__item__desc split reveal reveal-RTL">먼저 핀 꽃은 먼저진다. 남보다 먼저 공을 세우려고 조급히 서둘것이 아니다.</p>
</section>
<!-- //section9 -->
</div>
</main>
<!-- //main -->
<aside id="parallax__info">
<div class="scroll">scrollTop : <span>0</span>px</div>
</aside>
<!-- //aside -->
<footer id="footer">
<div class="modal__wrap">
<div class="modal__btn">소스 보기</div>
<div class="modal__cont">
<div class="modal__box">
<div class="title">
<span class="dot" aria-label="true"></span>
<div class="tabs">
<div class="active">
<span class="favicon" aria-label="true">
<svg width="16" height="16" viewBox="0 0 18 18" fill="none" aria-hidden="true"
focusable="false">
<circle cx="9" cy="9" r="9" fill="#fff"></circle>
<path
d="M18 9C18 13.9706 15.4688 3.09375 9 10.125C2.53125 17.1562 0 13.9706 0 9C0 4.02944 4.02944 0 9 0C13.9706 0 18 4.02944 18 9Z"
fill="orange"></path>
<path
d="M18 9C18 13.9706 14.9062 0.84375 8.29688 6.1875C1.6875 11.5312 0 13.9706 0 9C0 4.02944 4.02944 0 9 0C13.9706 0 18 4.02944 18 9Z"
fill="yellow"></path>
</svg>
</span>
<em>Javascript</em>
<span class="close">
<svg width="18" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"
focusable="false">
<path d="M12.5 3.5L3.5 12.5" stroke="currentColor" stroke-width="1.5"
stroke-linecap="round" stroke-linejoin="round"></path>
<path d="M12.5 12.5L3.5 3.5" stroke="currentColor" stroke-width="1.5"
stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
</span>
</div>
<div>
<span class="favicon" aria-label="true">
<svg width="16" height="16" viewBox="0 0 18 18" fill="none" aria-hidden="true"
focusable="false">
<circle cx="9" cy="9" r="9" fill="#fff"></circle>
<path
d="M18 9C18 13.9706 15.4688 3.09375 9 10.125C2.53125 17.1562 0 13.9706 0 9C0 4.02944 4.02944 0 9 0C13.9706 0 18 4.02944 18 9Z"
fill="orange"></path>
<path
d="M18 9C18 13.9706 14.9062 0.84375 8.29688 6.1875C1.6875 11.5312 0 13.9706 0 9C0 4.02944 4.02944 0 9 0C13.9706 0 18 4.02944 18 9Z"
fill="yellow"></path>
</svg>
</span>
<em>HTML</em>
<span class="close">
<svg width="18" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"
focusable="false">
<path d="M12.5 3.5L3.5 12.5" stroke="currentColor" stroke-width="1.5"
stroke-linecap="round" stroke-linejoin="round"></path>
<path d="M12.5 12.5L3.5 3.5" stroke="currentColor" stroke-width="1.5"
stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
</span>
</div>
<div>
<span class="favicon" aria-label="true">
<svg width="16" height="16" viewBox="0 0 18 18" fill="none" aria-hidden="true"
focusable="false">
<circle cx="9" cy="9" r="9" fill="#fff"></circle>
<path
d="M18 9C18 13.9706 15.4688 3.09375 9 10.125C2.53125 17.1562 0 13.9706 0 9C0 4.02944 4.02944 0 9 0C13.9706 0 18 4.02944 18 9Z"
fill="orange"></path>
<path
d="M18 9C18 13.9706 14.9062 0.84375 8.29688 6.1875C1.6875 11.5312 0 13.9706 0 9C0 4.02944 4.02944 0 9 0C13.9706 0 18 4.02944 18 9Z"
fill="yellow"></path>
</svg>
</span>
<em>CSS</em>
<span class="close">
<svg width="18" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"
focusable="false">
<path d="M12.5 3.5L3.5 12.5" stroke="currentColor" stroke-width="1.5"
stroke-linecap="round" stroke-linejoin="round"></path>
<path d="M12.5 12.5L3.5 3.5" stroke="currentColor" stroke-width="1.5"
stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
</span>
</div>
</div>
<span class="plus" aria-label="true">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"
focusable="false">
<path d="M2.5 8H13.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"
stroke-linejoin="round"></path>
<path d="M8 2.5V13.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"
stroke-linejoin="round"></path>
</svg>
</span>
</div>
<div class="cont">
<div class="active">
<pre><code class="language-js">
</code></pre>
</div>
<div>
<pre><code class="language-html">
</code></pre>
</div>
<div>
<pre><code class="language-css">
</code></pre>
</div>
</div>
</div>
<div class="modal__close">
<svg width="18" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false">
<path d="M12.5 3.5L3.5 12.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"
stroke-linejoin="round"></path>
<path d="M12.5 12.5L3.5 3.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"
stroke-linejoin="round"></path>
</svg>
</div>
</div>
</div>
</footer>
<!-- //footer -->
<script src="../assets/js/highlight.min.js"></script>
<script src="../assets/js/gsap.min.js"></script>
<script src="../assets/js/common.js"></script>
<script>
// reveal 클래스 자식요소에 글씨만 있다면, 가상으로 span 태그를 만들어서 넣어주세요 !
document.querySelectorAll(".reveal").forEach(el => {
let text = el.innerText;
// console.log(text);
if(text){
el.innerHTML = "<span>" + text + "</span>";
}
});
function scroll(){
let scrollTop = window.scrollY;
const reveal = document.querySelectorAll(".reveal");
reveal.forEach(el => {
let revealOffset = el.offsetTop + el.parentElement.offsetTop;
let revealDelay = el.dataset.delay;
// if(scrollTop > revealOffset - window.innerHeight){
// el.classList.add("show");
// }
if(scrollTop >= revealOffset - window.innerHeight){
if(revealDelay == undefined){
el.classList.add("show");
} else {
setTimeout(() => {
el.classList.add("show");
}, revealDelay)
}
}
});
document.querySelector("#parallax__info .scroll").innerText = Math.round(scrollTop);
requestAnimationFrame(scroll);
}
scroll();
</script>
</body>
</html>