cheapsea Posted December 3, 2020 Posted December 3, 2020 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
cheapsea Posted December 23, 2020 Author Posted December 23, 2020 Anyone know if this is do-able? Desperate to find a solution! Thank you 🙂
Solution tuanphan Posted January 2, 2021 Solution Posted January 2, 2021 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> ahasslocher 1 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!)
cheapsea Posted January 3, 2021 Author Posted January 3, 2021 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>
Rav Posted March 12, 2021 Posted March 12, 2021 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...
tuanphan Posted March 23, 2021 Posted March 23, 2021 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... 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> 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!)
AudeyTheConductor Posted March 3, 2022 Posted March 3, 2022 Hi! I am having a similar problem on my site https://newconductorsorch.squarespace.com/faq PW: newconductors This white logo disappears into the mobile overlay. This is actually a color logo, using SquareKicker to make it white. My "solution" is to use a completely different logo on the mobile overlay. [SquareKicker is not able to help me.] I have injected this into my header, it is not showing up at all. <style> /* hide current image */ body:not(.header--menu-open) .header-title-logo img { visibility: hidden!important; } /* set new image on burger menu click */ body:not(.header--menu-open) .header-title-logo a { background-image: url(https://static1.squarespace.com/static/61e9e0a1c56e13742a1a45a4/t/622017f14c29f83be16f38e8/1646270449115/Submark+Black.png)!important; background-size: cover!important; background-repeat: no-repeat!important; } </style> any ideas @tuanphan?
tuanphan Posted March 6, 2022 Posted March 6, 2022 On 3/3/2022 at 9:02 AM, AudeyTheConductor said: Hi! I am having a similar problem on my site https://newconductorsorch.squarespace.com/faq PW: newconductors This white logo disappears into the mobile overlay. This is actually a color logo, using SquareKicker to make it white. My "solution" is to use a completely different logo on the mobile overlay. [SquareKicker is not able to help me.] I have injected this into my header, it is not showing up at all. <style> /* hide current image */ body:not(.header--menu-open) .header-title-logo img { visibility: hidden!important; } /* set new image on burger menu click */ body:not(.header--menu-open) .header-title-logo a { background-image: url(https://static1.squarespace.com/static/61e9e0a1c56e13742a1a45a4/t/622017f14c29f83be16f38e8/1646270449115/Submark+Black.png)!important; background-size: cover!important; background-repeat: no-repeat!important; } </style> any ideas @tuanphan? Use this new code <style> body.header--menu-open .header-title { filter: unset !important; } body.header--menu-open header#header img { content: url(https://static1.squarespace.com/static/61e9e0a1c56e13742a1a45a4/t/622017f14c29f83be16f38e8/1646270449115/Submark+Black.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!)
HannaMai Posted May 16, 2022 Posted May 16, 2022 Hi there. I wanted to see if there is an updated code to achieve this? I used the latest code that was shared and it seems to not be working anymore. The existing logo is not hidden and replaced by the desired logo. lindz5223 1
ClareD Posted May 15, 2023 Posted May 15, 2023 I came across this problem recently (May 2023) and here is my solution - below is the code I inserted into the Page Header Code Injection in my case - incase it's helpful for anyone else searching for a solution to this problem 🙂 <style> /* Set a different logo for this page only - on desktop and mobile (if needed) */ div.header-title-logo a { content:url("INSERT_IMG_LINK"); max-width: 290px; margin-left: auto; margin-right: auto; } /* Hide Logo A when the mobile menu is open */ .header--menu-open .header-title-logo a { content: none; } /* Insert Logo B (as a background image) when the mobile menu is open */ .header--menu-open .header-title-logo a { background-image: url(INSERT_IMG_LINK); background-size: cover; background-repeat: no-repeat; } </style> noblestudio 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment