File tree Expand file tree Collapse file tree 4 files changed +77
-5
lines changed Expand file tree Collapse file tree 4 files changed +77
-5
lines changed Original file line number Diff line number Diff line change @@ -1426,16 +1426,37 @@ pre table {
1426
1426
}
1427
1427
}
1428
1428
}
1429
+
1430
+ html .banner-hidden .banner {
1431
+ display : none ;
1432
+ }
1429
1433
1430
1434
.banner {
1435
+ position : relative ;
1436
+ background-color : #2D2471 ;
1437
+ color : white ;
1438
+
1431
1439
.width-limiter {
1432
1440
padding-bottom : 10px ;
1433
1441
}
1434
1442
1435
- background-color : $grey-lt-300 ;
1436
- color : $text ;
1437
-
1438
- border-top : 1px solid $grey-dk-100 ;
1443
+ a {
1444
+ color : white ;
1445
+ text-decoration : underline ;
1446
+
1447
+ & :hover {
1448
+ opacity : 0.75 ;
1449
+ }
1450
+ }
1451
+
1452
+ .close-banner {
1453
+ position : absolute ;
1454
+ top : 50% ;
1455
+ right : 2rem ;
1456
+ margin-top : -12px ;
1457
+ width : 24px ;
1458
+ height : 24px ;
1459
+ }
1439
1460
}
1440
1461
1441
1462
.client-list {
Original file line number Diff line number Diff line change @@ -6,6 +6,21 @@ window.toggleHeaderMenu = function() {
6
6
}
7
7
} ;
8
8
9
+ // Banner close functionality
10
+ function initBannerClose ( ) {
11
+ const banner = document . querySelector ( '.banner' ) ;
12
+ const closeButton = document . querySelector ( '.close-banner' ) ;
13
+
14
+ if ( ! banner || ! closeButton ) return ;
15
+
16
+ // Add click event to close button
17
+ closeButton . addEventListener ( 'click' , function ( e ) {
18
+ e . preventDefault ( ) ; // Prevent navigation to home page
19
+ document . documentElement . classList . add ( 'banner-hidden' ) ;
20
+ localStorage . setItem ( 'bannerClosedTime' , Date . now ( ) . toString ( ) ) ;
21
+ } ) ;
22
+ }
23
+
9
24
// Set active menu item based on current URL
10
25
function setActiveMenuItem ( ) {
11
26
const nav = document . querySelector ( '.header nav' ) ;
@@ -30,7 +45,10 @@ function setActiveMenuItem() {
30
45
}
31
46
32
47
// Run when DOM is loaded
33
- document . addEventListener ( 'DOMContentLoaded' , setActiveMenuItem ) ;
48
+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
49
+ setActiveMenuItem ( ) ;
50
+ initBannerClose ( ) ;
51
+ } ) ;
34
52
35
53
// Class detection function that checks if an element with a given class name exists
36
54
// This provides backwards compatibility for older browsers (IE6-8) that don't support getElementsByClassName
Original file line number Diff line number Diff line change 1
1
{%- block head -%}{%- endblock -%}<!DOCTYPE html>
2
2
< html lang ="{{ page.lang | default(value=config.default_language) }} ">
3
3
{% include "includes/head.html" %}
4
+ < script >
5
+ // Banner state management: Check localStorage before DOM renders to prevent layout shift
6
+ // and ensure banner visibility state is consistent with user's previous interactions.
7
+ ( function ( ) {
8
+ const bannerClosedTime = localStorage . getItem ( 'bannerClosedTime' ) ;
9
+ if ( bannerClosedTime ) {
10
+ const closedTime = parseInt ( bannerClosedTime , 10 ) ;
11
+ const twentyFourHours = 24 * 60 * 60 * 1000 ; // 24 hours in ms
12
+ if ( Date . now ( ) - closedTime < twentyFourHours ) {
13
+ document . documentElement . classList . add ( 'banner-hidden' ) ;
14
+ } else {
15
+ // Clear expired timestamp
16
+ localStorage . removeItem ( 'bannerClosedTime' ) ;
17
+ }
18
+ }
19
+ } ) ( ) ;
20
+ </ script >
4
21
< body
5
22
{%- if page.extra.sectionid -%} id ="{{ page.extra.sectionid }} "{%- endif -%}
6
23
{% if page.extra.body_class %} class ="{{ page.extra.body_class }} "{% endif %}
11
28
< div class ="width-limiter ">
12
29
{{ config.extra.banner | markdown | safe}}
13
30
</ div >
31
+ < a href ="/ " class ="close-banner ">
32
+ < img src ="/img/icon-outline-close.svg " alt ="Icon Close " width ="16 " height ="16 "/>
33
+ </ a >
14
34
</ div >
15
35
{%- endif -%}
16
36
< div class ="header ">
You can’t perform that action at this time.
0 commit comments