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 11.banner-container {
22 display : none ;
33 top : $headerHeight ;
4+ transition : top .2s ;
5+
6+ & .active {
7+ top : $activeHeaderHeight ;
8+ }
9+
410 @media screen AND (min-width : $bp-md ) {
511 display : block ;
612 position : fixed ;
Original file line number Diff line number Diff line change @@ -127,10 +127,33 @@ function handleEvents(): void {
127127 }
128128 }
129129
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+
130145 loadRemainingEventImpressions ( ) ;
131146 displayEvents ( "banner" ) ;
132147 displayEvents ( "sticker" ) ;
133148 saveRemainingEventImpressions ( ) ;
149+
150+ if ( document . readyState !== "loading" ) {
151+ toggleActiveHeader ( ) ;
152+ }
153+
154+ listen ( window , "scroll" , ( ) => {
155+ toggleActiveHeader ( ) ;
156+ } ) ;
134157}
135158
136159handleEvents ( ) ;
You can’t perform that action at this time.
0 commit comments