Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Changing logo colour ONLY in mobile menu overlay (7.1)


cheapsea

Question

Site URL: https://fifty-fifth.com/

Hey! 

I've recently changed the logo colour on multiple pages on my site from navy to white - when viewing the site on mobile the pages with the white logo look a lot better when you click the burger and the menu overlay appears with my green background.

I want to make it so that when you press the burger icon on the pages with a navy logo, the logo changes to white when the green overlay appears. Is this possible with CSS? 

Thanks so much. 

Ned

Link to comment
  • Answers 5
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

Posted Images

5 answers to this question

Recommended Posts

  • 0

Add this to Page Header

<style>
  /* hide current image */
.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/5e8a138dedf9386b7757061f/t/5fc8e19e90a4f8549d839be0/1607000480214/%5BSITE%5D+%23FF_MASTER-LOGO_WHITE.png);
    background-size: cover;
    background-repeat: no-repeat;
}
</style>

 

Link to comment
  • 0
On 1/2/2021 at 9:31 AM, tuanphan said:

Add this to Page Header


<style>
  /* hide current image */
.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/5e8a138dedf9386b7757061f/t/5fc8e19e90a4f8549d839be0/1607000480214/%5BSITE%5D+%23FF_MASTER-LOGO_WHITE.png);
    background-size: cover;
    background-repeat: no-repeat;
}
</style>

 

Nailed it - thank you so much, you're a life saver! 

It didn't work at first but I made a slight addition to the 'hide current image' section and it worked perfectly.

New code below: 

<style>
/* 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/5e8a138dedf9386b7757061f/t/5fc8e19e90a4f8549d839be0/1607000480214/%5BSITE%5D+%23FF_MASTER-LOGO_WHITE.png);
    background-size: cover;
    background-repeat: no-repeat;
}
</style>

 

Link to comment
  • 0

Hey @tuanphan this code doesn't work for me. Can you please help?

So I've got this code to display a different logo on the page in general...

<style> 
div.header-title-logo a {
content:url("https://static1.squarespace.com/static/5611841fe4b0f085582f2aa7/t/5ddc2f3f2e5a7339b69c08b2/1578936481584/?format=1500w") !important;     
max-width: 290px;
/* if logo needs to be centered */
margin-left: auto;
margin-right: auto;
}
</style>

But using your code in this post, it doesn't hide that logo when the menu overlay is open. It overlaps the both of them on top of each other.

<style>
  /* hide current image */
.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/5e8a138dedf9386b7757061f/t/5fc8e19e90a4f8549d839be0/1607000480214/%5BSITE%5D+%23FF_MASTER-LOGO_WHITE.png);
    background-size: cover;
    background-repeat: no-repeat;
}
</style>

See screenshot...

Screenshot 2021-03-12 at 07.52.47.png

Link to comment
  • 0
On 3/12/2021 at 2:56 PM, Rav said:

Hey @tuanphan this code doesn't work for me. Can you please help?

So I've got this code to display a different logo on the page in general...


<style> 
div.header-title-logo a {
content:url("https://static1.squarespace.com/static/5611841fe4b0f085582f2aa7/t/5ddc2f3f2e5a7339b69c08b2/1578936481584/?format=1500w") !important;     
max-width: 290px;
/* if logo needs to be centered */
margin-left: auto;
margin-right: auto;
}
</style>

But using your code in this post, it doesn't hide that logo when the menu overlay is open. It overlaps the both of them on top of each other.


<style>
  /* hide current image */
.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/5e8a138dedf9386b7757061f/t/5fc8e19e90a4f8549d839be0/1607000480214/%5BSITE%5D+%23FF_MASTER-LOGO_WHITE.png);
    background-size: cover;
    background-repeat: no-repeat;
}
</style>

See screenshot...

Screenshot 2021-03-12 at 07.52.47.png

Try new code

<style>
  /* hide current image */
body:not(.header--menu-open) .header-title-logo img {
    visibility: hidden;
}
  /* set new image on burger menu click */
  body:not(.header--menu-open) .header-title-logo a {
    background-image: url(https://static1.squarespace.com/static/5e8a138dedf9386b7757061f/t/5fc8e19e90a4f8549d839be0/1607000480214/%5BSITE%5D+%23FF_MASTER-LOGO_WHITE.png);
    background-size: cover;
    background-repeat: no-repeat;
}
</style>

 

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...