Jump to content

Custom header on the homepage with color changing background and font at the scroll

Go to solution Solved by tuanphan,

Recommended Posts

Hello All 🙂 

Short story: On my homepage, I have a "dark" video, so I decided to change my logo and menu elements to white with transparent background when I scroll the background turn white, and the logo and all elements in the navigation header are black.

The issue: The code I add only work I open the custom CSS page, when I save and navigate only my logo remain before the scroll all the other elements are black.  Can you please help me fix that issue?  🫶

The demonstration below when CSS opens: 

Capturedecran2023-07-01a17_20_20.thumb.png.059c0bb46e7781327e376b681a962ce9.png

Demonstration on the nav

Capturedecran2023-07-01a17_20_45.thumb.png.1b463ac73a38e26161ddea8f833bd5e6.png

The code currently used on CSS customisation : 

/* 1 - logo color */
.homepage .header-title-logo img {
    -webkit-filter: invert(100%);
    filter: invert(100%); 
  filter:progid:DXImageTransform.Microsoft.BasicImage(invert='1');
  }
.homepage #header.shrink .header-title-logo img {
    -webkit-filter: invert(0%);
    filter: invert(0%); 
  filter:progid:DXImageTransform.Microsoft.BasicImage(invert='1');
}

/*2 -  menu list color */
/*on scroll change*/
.homepage #header.shrink .header-nav-item {
    color: black !important;
}

.homepage .header-nav-item {
    color: #ffff !important;
}
/* 3 - socials icons color */
.homepage .header-actions-action--social {
color : #ffff !important; 
}
/*on scroll change*/
.homepage #header.shrink .header-actions-action--social {
    color: black !important;
}


/*4 -  language selection color */
.homepage .current-language {
color : #ffff !important; 
}
/*on scroll change*/
.homepage #header.shrink .current-language {
    color: black !important;
}


/* 5 - cart color */
.homepage .Cart-inner {
color : #ffff !important; 
}
/*on scroll change*/
.homepage #header.shrink .Cart-inner {
    color: black !important;
}


/* 6 - Onscroll header color */
.homepage #header.shrink {
    background-color: white !important;
}

/*Mobile version*/
.homepage .header-burger-btn burger {
    background-color: white !important;
}

Link to comment
  • Replies 4
  • Views 457
  • Created
  • Last Reply

Top Posters In This Topic

  • Solution

Add this to Design > Custom CSS to change icons, nav items to white on homepage before scroll

body.homepage header#header:not(.shrink) a {
    color: white !important;
}
body.homepage header#header:not(.shrink) span.current-language-name {
    color: white;
}

image.thumb.png.aaf95fe5cb32088498c3d702f7b75de9.png

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.