File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1
1
.banner-container {
2
2
display : none ;
3
3
top : $headerHeight ;
4
+ transition : top .2s ;
5
+
6
+ & .active {
7
+ top : $activeHeaderHeight ;
8
+ }
9
+
4
10
@media screen AND (min-width : $bp-md ) {
5
11
display : block ;
6
12
position : fixed ;
Original file line number Diff line number Diff line change @@ -127,10 +127,33 @@ function handleEvents(): void {
127
127
}
128
128
}
129
129
130
+ const banner = getByClass ( "banner-container" ) ;
131
+ function toggleActiveHeader ( ) : void {
132
+ const top = window . scrollY ;
133
+
134
+ if ( ! banner ) {
135
+ return ;
136
+ }
137
+
138
+ if ( top >= 10 ) {
139
+ banner [ 0 ] . classList . add ( "active" ) ;
140
+ } else {
141
+ banner [ 0 ] . classList . remove ( "active" ) ;
142
+ }
143
+ }
144
+
130
145
loadRemainingEventImpressions ( ) ;
131
146
displayEvents ( "banner" ) ;
132
147
displayEvents ( "sticker" ) ;
133
148
saveRemainingEventImpressions ( ) ;
149
+
150
+ if ( document . readyState !== "loading" ) {
151
+ toggleActiveHeader ( ) ;
152
+ }
153
+
154
+ listen ( window , "scroll" , ( ) => {
155
+ toggleActiveHeader ( ) ;
156
+ } ) ;
134
157
}
135
158
136
159
handleEvents ( ) ;
You can’t perform that action at this time.
0 commit comments