Skip to content

Commit 3bb084f

Browse files
committed
Day 5
1 parent adeb857 commit 3bb084f

1 file changed

Lines changed: 34 additions & 3 deletions

File tree

05 - Flex Panel Gallery/index-START.html

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,14 @@
2424
.panels {
2525
min-height:100vh;
2626
overflow: hidden;
27+
display: flex;
2728
}
2829

2930
.panel {
31+
display: flex;
32+
flex-direction: column;
33+
justify-content: center;
34+
flex: 1;
3035
background:#6B0F9C;
3136
box-shadow:inset 0 0 0 5px rgba(255,255,255,0.1);
3237
color:white;
@@ -43,7 +48,6 @@
4348
background-position:center;
4449
}
4550

46-
4751
.panel1 { background-image:url(https://source.unsplash.com/gYl-UtwNg_I/1500x1500); }
4852
.panel2 { background-image:url(https://source.unsplash.com/1CD3fd8kHnE/1500x1500); }
4953
.panel3 { background-image:url(https://images.unsplash.com/photo-1465188162913-8fb5709d6d57?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&cs=tinysrgb&w=1500&h=1500&fit=crop&s=967e8a713a4e395260793fc8c802901d); }
@@ -53,7 +57,11 @@
5357
.panel > * {
5458
margin:0;
5559
width: 100%;
56-
transition:transform 0.5s;
60+
transition: transform 0.5s cubic-bezier(0.61,-0.19, 0.7,-0.11) 0.5s;
61+
flex: 1;
62+
display: flex;
63+
justify-content: center;
64+
align-items: center;
5765
}
5866

5967
.panel p {
@@ -62,12 +70,30 @@
6270
text-shadow:0 0 4px rgba(0, 0, 0, 0.72), 0 0 14px rgba(0, 0, 0, 0.45);
6371
font-size: 2em;
6472
}
73+
6574
.panel p:nth-child(2) {
6675
font-size: 4em;
6776
}
6877

6978
.panel.open {
7079
font-size:40px;
80+
flex: 5;
81+
}
82+
83+
.panel > *:first-child {
84+
transform: translateY(-100%);
85+
}
86+
87+
.panel.open > *:first-child {
88+
transform: translateY(0);
89+
}
90+
91+
.panel > *:last-child {
92+
transform: translateY(100%);
93+
}
94+
95+
.panel.open > *:last-child {
96+
transform: translateY(0);
7197
}
7298

7399
.cta {
@@ -107,7 +133,12 @@
107133
</div>
108134

109135
<script>
110-
136+
const panels = document.querySelectorAll('.panel');
137+
panels.forEach((panel) => (
138+
panel.addEventListener('click', (e) => (
139+
e.currentTarget.classList.toggle('open')
140+
))
141+
))
111142
</script>
112143

113144

0 commit comments

Comments
 (0)