Skip to content

Commit ddf8541

Browse files
authored
Add files via upload
Personal image gallery in JS30 wesbos#5
1 parent e831e7f commit ddf8541

File tree

6 files changed

+144
-0
lines changed

6 files changed

+144
-0
lines changed

bs-1.jpg

553 KB
Loading

bs-2.jpg

422 KB
Loading

bs-4.jpg

379 KB
Loading

bs-5.jpg

496 KB
Loading

bs-6.jpg

276 KB
Loading

index-START.html

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Flex Panels 💪</title>
6+
<link href='https://fonts.googleapis.com/css?family=Amatic+SC' rel='stylesheet' type='text/css'>
7+
</head>
8+
<body>
9+
<style>
10+
html {
11+
box-sizing: border-box;
12+
background: black;
13+
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
14+
font-size: 20px;
15+
font-weight: 200;
16+
}
17+
18+
body {
19+
margin: 0;
20+
}
21+
22+
*, *:before, *:after {
23+
box-sizing: inherit;
24+
}
25+
26+
.panels {
27+
min-height: 100vh;
28+
overflow: hidden;
29+
display: flex;
30+
}
31+
32+
.panel {
33+
justify-content: center;
34+
align-items: center;
35+
display: flex;
36+
flex-direction: column;
37+
flex: 1;
38+
background: brown;
39+
box-shadow: inset 0 0 0 5px black(255,255,255,0.1);
40+
color: white;
41+
text-align: center;
42+
align-items: center;
43+
/* Safari transitionend event.propertyName === flex */
44+
/* Chrome + FF transitionend event.propertyName === flex-grow */
45+
transition:
46+
font-size 0.7s cubic-bezier(0.61,-0.19, 0.7,-0.11),
47+
flex 0.7s cubic-bezier(0.61,-0.19, 0.7,-0.11),
48+
background 0.2s;
49+
font-size: 20px;
50+
background-size: cover;
51+
background-position: center;
52+
}
53+
54+
.panel1 { background-image:url(bs-1.jpg); }
55+
.panel2 { background-image:url(bs-2.jpg); }
56+
.panel3 { background-image:url(bs-5.jpg); }
57+
.panel4 { background-image:url(bs-4.jpg); }
58+
.panel5 { background-image:url(bs-6.jpg); }
59+
60+
/* Flex Children */
61+
.panel > * {
62+
margin: 0;
63+
width: 100%;
64+
transition: transform 0.5s;
65+
flex : 1 0 auto;
66+
display: flex;
67+
justify-content: center;
68+
align-items: center;
69+
}
70+
71+
.panel > *:first-child {transform: translateY(-100%);}
72+
.panel.open-active > *:first-child {transform: translateY(0);}
73+
.panel > *:last-child {transform: translateY(100%);}
74+
.panel.open-active > *:last-child {transform: translateY(0);}
75+
76+
.panel p {
77+
text-transform: uppercase;
78+
font-family: 'Amatic SC', cursive;
79+
text-shadow: 0 0 4px rgba(0, 0, 0, 0.72), 0 0 14px rgba(0, 0, 0, 0.45);
80+
font-size: 2em;
81+
}
82+
83+
.panel p:nth-child(2) {
84+
font-size: 4em;
85+
}
86+
87+
.panel.open {
88+
font-size: 40px;
89+
flex: 5;
90+
}
91+
92+
</style>
93+
94+
95+
<div class="panels">
96+
<div class="panel panel1">
97+
<p>Most</p>
98+
<p>Cutest</p>
99+
<p>Dog</p>
100+
</div>
101+
<div class="panel panel2">
102+
<p>Cutest</p>
103+
<p>Dog</p>
104+
<p>Ever</p>
105+
</div>
106+
<div class="panel panel3">
107+
<p>She's</p>
108+
<p>In</p>
109+
<p>Style</p>
110+
</div>
111+
<div class="panel panel4">
112+
<p>And</p>
113+
<p>The</p>
114+
<p>Best</p>
115+
</div>
116+
<div class="panel panel5">
117+
<p>In</p>
118+
<p>World</p>
119+
<p>History</p>
120+
</div>
121+
</div>
122+
123+
<script>
124+
125+
const panels = document.querySelectorAll('.panel');
126+
127+
function toggleOpen(){
128+
this.classList.toggle('open');
129+
}
130+
131+
function toggleActive(e){
132+
if(e.propertyName.includes('flex')){
133+
this.classList.toggle('open-active');
134+
}
135+
}
136+
137+
panels.forEach(panel => panel.addEventListener('click', toggleOpen));
138+
panels.forEach(panel => panel.addEventListener('transitionend', toggleActive));
139+
</script>
140+
141+
142+
143+
</body>
144+
</html>

0 commit comments

Comments
 (0)