Jump to content

Change the logo colour for mobile hamburger menu - 7.1

Go to solution Solved by tuanphan,

Recommended Posts

I'm using a dynamic menu, which works for most of my pages, but with a couple of my pages (FAQs and Services), the first section is the same colour as my logo. I have managed to implement CSS to switch out the logo to a different colour for the affected pages. It works well, apart from with the hamburger menu on mobile. 

I have followed the instructions to replace the hamburger logo for affected pages, but it doesn't seem to be hiding the original logo properly, so I get two logos overlapping, giving a funny outline. Can someone help me by taking a look at the code and see what's going on?

Code has been implemented in the "Advanced" section of the specific page, and not the site-wide CSS panel.

Website: https://aspiring-dental.squarespace.com

Password: Aspiring-Dental-2023

 

 

<style> 
div.header-title-logo a {
content:url("https://static1.squarespace.com/static/64ae1056de93ab723f53c4f3/t/64c8726fe5dffc761d47c949/1690858095063/AspiringDental_Logo_RGB_Blue.png") !important;     
max-width: 300px;
}
 
// mobile menu //
/* hide current image */
body.header--menu-open .header-title-logo img {
    visibility: hidden;
}
  /* set new image on burger menu click */
  body.header--menu-open .header-title-logo a {
    background-image: url(https://static1.squarespace.com/static/64ae1056de93ab723f53c4f3/t/64c877652a73de35bf04a12a/1690859365906/AspiringDental_Logo_RGB_Cream.png);
    background-size: cover;
    background-repeat: no-repeat;
}
</style>

Screenshot 2023-08-01 at 4.42.48 PM.png

Screenshot 2023-08-01 at 4.42.58 PM.png

Screenshot 2023-08-01 at 4.43.51 PM.png

Link to comment
  • Solution

To replace Logo, use this new shorter code

<style> 
body:not(.header--menu-open) header#header img {
content:url(https://static1.squarespace.com/static/64ae1056de93ab723f53c4f3/t/64c8726fe5dffc761d47c949/1690858095063/AspiringDental_Logo_RGB_Blue.png) !important;}
  body.header--menu-open header#header img {
    content: url(https://static1.squarespace.com/static/64ae1056de93ab723f53c4f3/t/64c877652a73de35bf04a12a/1690859365906/AspiringDental_Logo_RGB_Cream.png);}
</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!)

Link to comment
  • 6 months later...

Hi,

 

I am using the code you provided, and it works great. However it's to big on mobile. How can I set the height/size I want on mobile? (The logo inside the hamburger menu is correct)

 

<style>
body:not(.header--menu-open)
div.header-title-logo a {
content:url("https://static1.squarespace.com/static/658352163290836ffdcab59a/t/65d8b1cc1d63ae7ef1d45d2a/1708700108553/Storywell+hvit.png/") !important;     
max-height: 60px;
}
</style>

 

Link to comment
On 2/25/2024 at 12:55 AM, LK89 said:

Hi,

 

I am using the code you provided, and it works great. However it's to big on mobile. How can I set the height/size I want on mobile? (The logo inside the hamburger menu is correct)

 

<style>
body:not(.header--menu-open)
div.header-title-logo a {
content:url("https://static1.squarespace.com/static/658352163290836ffdcab59a/t/65d8b1cc1d63ae7ef1d45d2a/1708700108553/Storywell+hvit.png/") !important;     
max-height: 60px;
}
</style>

 

Use this new code instead

<style>
body:not(.header--menu-open) header#header img {
content:url("https://static1.squarespace.com/static/658352163290836ffdcab59a/t/65d8b1cc1d63ae7ef1d45d2a/1708700108553/Storywell+hvit.png/") !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!)

Link to comment
On 2/27/2024 at 2:36 AM, LK89 said:

Hi again,

Encountered a slight bug while using the code.

I use Weglot for translating, and now instead of the flags, it shows the logo. Is there a way to fix this?

 

image.png.40abb634876dbcac0e8e005ab3ea276c.png

Use this new code

<style> 
body:not(.header--menu-open) header#header img:not(.flag) {
content:url("https://static1.squarespace.com/static/658352163290836ffdcab59a/t/65d8b1cc1d63ae7ef1d45d2a/1708700108553/Storywell+hvit.png/") !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!)

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.