Transparent header, to white on scroll in theme Refresh

Transparent header, to white on scroll in theme Refresh

stride
Tourist
15 0 1

I would like my header to be transparent with white text on my homepage. On scroll it should then transfrom into white header with black text. I'm using a Shopify theme - Refresh. I've tried adding css and java script before but it didn't work properly.

Replies 7 (7)
stride
Tourist
15 0 1

it's stridedrinks.com

Bundler-Manuel
Astronaut
1021 51 119

Hello @stride  Try out the steps and code in the marked reply here https://community.shopify.com/c/shopify-design/how-can-i-create-a-transparent-header-on-the-refresh-... 

this should be able to make your header transparent as you’d like.

Emmanuel
Please let me know if it works by marking it as a solution!
Bundler - Product Bundles app, a great bundle app for Shopify, with glowing user testimonials and a free plan.

Dan-From-Ryviu
Shopify Partner
11715 2294 2476

Hi @stride 

Please add this code to theme.liquid file, after <head> in Online Store > Themes > Edit theme

{% if template == 'index' %}
<style>
.section-header .header-wrapper {
background: transparent;
}
.section-header .header__icon .svg-wrapper,
.section-header header .header__menu-item span {
color: #fff;
}
.section-header .header__heading-logo { 
filter: invert(1); 
}
html .section-header.scrolled-past-header .header-wrapper {
background: #fff;
}
html .section-header.scrolled-past-header .header__icon .svg-wrapper,
html .section-header.scrolled-past-header header .header__menu-item span {
color: #141414;
}
html .section-header.scrolled-past-header .header__heading-logo { 
filter: invert(0); 
}
#MainContent { margin-top: -66px; }
@media (max-width:749px) { 
.section-header .header__icon--menu .icon {
color: #fff;
}
html .section-header.scrolled-past-header .header__icon--menu .icon {
color: #141414;
}
html #shopify-section-sections--22799632531782__header header {
background-color: transparent;
}
html #MainContent {
    margin-top: -63px;
}
}
</style>
{% endif %}

Screenshot 2024-12-23 at 14.54.38.pngScreenshot 2024-12-23 at 14.54.44.pngScreenshot 2024-12-23 at 14.54.54.pngScreenshot 2024-12-23 at 14.54.59.png

 

- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Amazon Products Importer - Import Amazon Products to Dropship in Your Store!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...
Sign up now.

stride
Tourist
15 0 1

Hi! Thanks for the help, I've tried adding the code as you said but it's still not working. The photos you sent are a perfect example of how it should work though.

Dan-From-Ryviu
Shopify Partner
11715 2294 2476

Where did you add the code? Did you save file after adding code? 

- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Amazon Products Importer - Import Amazon Products to Dropship in Your Store!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...
Sign up now.

stride
Tourist
15 0 1

Yes, i've saved it. I've added it like this themeliquid.png

Dan-From-Ryviu
Shopify Partner
11715 2294 2476

Hi, cannot see the code in the HTML of your site. Make sure you added code to theme.liquid file of the current theme. 

- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Amazon Products Importer - Import Amazon Products to Dropship in Your Store!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...
Sign up now.