AJeans Posted April 25, 2023 Share Posted April 25, 2023 Does anyone out there know how to use CSS to change the site logo (white version to black version) ONLY when a mega menu is open/active? Context: I have both black and white versions as separate files on my site. The black version is the primary logo throughout the site, but I have used this code to switch to the white version on the homepage until you scroll. //// HOME PAGE INITIAL WHITE LOGO /// /**desktop logo**/ @media screen and (min-width:767px) { #collection-642dd8240a60c7018cf63f5d .header-title-logo img { content: url("https://static1.squarespace.com/static/642cf2bb3411145e70873b6a/t/64401e41b9f32a191d16461e/1681923649471/Lock+and+Mortice+Logo+White-1000.png") !important; max-height:inherit !important; } } /**mobile logo**/ @media screen and (max-width:767px) { #collection-642dd8240a60c7018cf63f5d .header-display-mobile .header-title-logo img { content: url("https://static1.squarespace.com/static/642cf2bb3411145e70873b6a/t/64401e41b9f32a191d16461e/1681923649471/Lock+and+Mortice+Logo+White-1000.png") !important; max-height:inherit !important; } } /* SCROLLS TO BLACK HEADER */ header#header.shrink { background: #FFFFFF !important; transition: 0.5s ease-in; } header#header.shrink img { filter: brightness(0) invert(0); } header#header.shrink .header-nav-list * { color: #282829; transition: 0.2s ease-in; } header#header.shrink .header-actions * { fill: #282829; stroke: #282829; } //// end of HOME PAGE NAV edits /// ----- This is what I tried, with no luck so far. (It does change the navigation colour successfully!) .mega-menu-open .header-announcement-bar-wrapper, .mega-menu-open { .header-nav *, nav.header-menu-nav-list * { color: #282829; transition: 0.1s ease-out; } } .mega-menu-open .header-announcement-bar-wrapper, .mega-menu-open { .header-title-logo img { content: url("https://static1.squarespace.com/static/642cf2bb3411145e70873b6a/t/64480560c173a917181c7029/1682441568120/Lock+and+Mortice+Logo+Black-1000.png") !important; max-height:inherit !important; z-index:999999 !important; } } https://decagon-caribou-s63f.squarespace.com/ PW; blackpanther EarvinChong 1 Link to comment
Solution tuanphan Posted April 26, 2023 Solution Share Posted April 26, 2023 Add to Design > Custom CSS header#header.mega-menu-open img { filter: invert(1); -webkit-filter: invert(1); } EarvinChong and AJeans 1 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!) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment