Have header be transparent before scrolling

Topic summary

A user wants to implement a transparent header on their Shopify homepage that transitions to a black background when scrolling, similar to their pre-Dawn theme setup. They provided before/after images showing the desired effect.

Initial Solution Provided:

  • Add custom CSS code to theme.liquid file above the </body> tag
  • Code uses {% if template == 'index' %} to target homepage only
  • Makes header position absolute with transparent background

Follow-up Issues:

  • The solution successfully made the header transparent but didn’t add the scroll-triggered black background
  • User also requested extending the absolute positioning to all pages, not just homepage

Additional Resource:
Another participant suggested three OnHOW YouTube tutorials covering:

  • Transparent header creation
  • Header behavior on hover
  • Header behavior on scroll

The discussion remains partially resolved—the transparency works, but the scroll-based background change still needs implementation.

Summarized with AI on October 31. AI used: claude-sonnet-4-5-20250929.

Hi!

I’m wanting the shop banner to start off transparent but have a black background after scrolling, but only on the homepage. If its possible for it to fade in then that would be even better, but no worries if not.

It used to look like this before the new Dawn update:

1 Like

Hey @DSFilmLabs

Follow these Steps:

  1. Go to Online Store

  2. Edit Code

  3. Find theme.liquid file

  4. Add the following code in the bottom of the file above tag

{% if template == 'index' %}

{% endif %}

RESULT:

If I managed to help you then, don’t forget to Like it and Mark it as Solution!

Best Regards,
Moeed

1 Like

Hi Moeed,

That looks great but it doesn’t add a black background when I scroll, how do I add that?

Also the absolute width looks great and I’d like to add it to all of the pages if you can help with that as well.

I’m not sure if it is permitted to post YouTube links here, but the channel OnHOW has three videos that might help. He posts the code in his Description box for each video

How To Make A Transparent Header In Shopify# How To Have Header Not Transparent On Hover In Shopify# How To Have Header Not Transparent On Scroll In Shopify

1 Like

Brilliant, thank you.