Jump to content

How to fully customizable the transparent & fixed header

Go to solution Solved by tuanphan,

Recommended Posts

Posted

Hi!

For a website I'm working on, I'm trying to create a transparent, fixed header that will change it's font & logo color on scroll.

For example; on the homepage you'll see a transparent header with an off-white logo & navigation and I want to let it change to a white background with a black logo & navigation when scrolling. (I'm not looking for changing the color settings of the block below).

Is there anyone who has some code to do it?

URL: https://notyourtherapist.squarespace.com/
password: anuroopa

Thank you!

  • Replies 3
  • Views 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

Posted

You can use this code to Website > Website Tools > Custom CSS

/* HOMEPAGE - Header scroll */
body.homepage {
/* header color */
header#header.shrink {
    background-color: white !important;
}
header#header.shrink img {
    filter: invert(0);
}
/* navigation items */
header#header.shrink div.header-nav-item>a {
    color: #000 !important;
}
/* Burger Icon */
header#header.shrink .burger-inner>div {
    background-color: #000 !important;
}
}
/* Burger X Close icon */
body.homepage.header--menu-open header#header.shrink .burger-inner>div {
    background-color: #000 !important;
}

 

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!)

  • Solution
Posted
On 2/8/2024 at 3:35 PM, tevestudios said:

@tuanphan thank you so much! This worked! 

Last question; what if I want to add this to a specific page? What do I use instead of body.homepage?

You can add this code to Page Header Code Injection or Code Block

<style>
  /* header color */
header#header.shrink {
    background-color: white !important;
}
header#header.shrink img {
    filter: invert(0);
}
/* navigation items */
header#header.shrink div.header-nav-item>a {
    color: #000 !important;
}
/* Burger Icon */
header#header.shrink .burger-inner>div {
    background-color: #000 !important;
}
/* Burger X Close icon */
body.header--menu-open header#header.shrink .burger-inner>div {
    background-color: #000 !important;
}
</style>

 

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!)

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.