File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 2424 .panels {
2525 min-height : 100vh ;
2626 overflow : hidden;
27+ display : flex;
2728 }
2829
2930 .panel {
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
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 {
6895
6996 .panel .open {
7097 font-size : 40px ;
98+ flex : 5 ;
7199 }
72100
73101 .cta {
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
You can’t perform that action at this time.
0 commit comments