Skip to content

Commit 622d7e3

Browse files
committed
finises with bugz
1 parent 38a754c commit 622d7e3

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
.panels {
2525
min-height:100vh;
2626
overflow: hidden;
27+
display: flex;
2728
}
2829

2930
.panel {
@@ -41,6 +42,12 @@
4142
font-size: 20px;
4243
background-size:cover;
4344
background-position:center;
45+
46+
flex: 1 0 auto;
47+
/*justify-content: center;*/
48+
align-content: center;
49+
display: flex;
50+
flex-direction: column;
4451
}
4552

4653

@@ -54,6 +61,26 @@
5461
margin:0;
5562
width: 100%;
5663
transition:transform 0.5s;
64+
flex: 1 0 auto;
65+
justify-content: center;
66+
align-items: center;
67+
}
68+
69+
70+
.panel > *:first-child {
71+
transform: translateY(-100%);
72+
}
73+
74+
.panel > *:last-child {
75+
transform: translateY(100%);
76+
}
77+
78+
.panel.open-active > *:first-child {
79+
transform: translateY(0);
80+
}
81+
82+
.panel.open-active > *:last-child {
83+
transform: translateY(0);
5784
}
5885

5986
.panel p {
@@ -68,6 +95,7 @@
6895

6996
.panel.open {
7097
font-size:40px;
98+
flex: 5;
7199
}
72100

73101
.cta {
@@ -107,7 +135,25 @@
107135
</div>
108136

109137
<script>
138+
const panels = document.querySelectorAll('.panel');
139+
140+
141+
function toggleOpen() {
142+
this.classList.toggle('open');
143+
}
144+
145+
function toggleActive(e) {
146+
if(e.propertyName.includes('flex')) {
147+
this.classList.toggle('open-active');
148+
console.log('hello');
149+
}
150+
151+
}
152+
153+
110154

155+
panels.forEach(panel => panel.addEventListener('click', toggleOpen));
156+
panels.forEach(panel => panel.addEventListener('transitionend', toggleActive));
111157
</script>
112158

113159

0 commit comments

Comments
 (0)