How to make text + icon white and change back to default after scrolling in header

Dear all,

I’ve a custom header on home page when it’s not scrolled, it’s transparent, but when you scroll it’s with white background.

Now I’ve added language selector (custom one from an app) and I want to change the text color to white when it’s not scrolled, and back to default when it’s scrolled.

I managed to do this, but it’s doing it for all pages, I only want this in homepage.

So when it’s not scrolled I want this to white (only in homepage)

also border color please.

Website: https://b6c7e8-65.myshopify.com/

Pass: test

Appreciate your help in advance,

Kind regards,

Lisa,

1 Like
  • Here is the solution for you @Lisavdijk
  • Please follow these steps:
  1. Go to Online Store → Theme → Edit code.
  2. Open your theme.liquid file
  3. In theme.liquid, paste the below code before and press ‘Save’ to save it

1 Like
  • Here is the result you will achieve:

  • Please press ‘Like’ and mark it as ‘Solution’ if you find it helpful. Thank you.
1 Like

Hi @Lisavdijk

  • Go to Online Store → Theme → Edit code.
  • Find the file base.css and paste the code below at the bottom of the file.

.tl-switcher.tl-language .tl-select {
background: white!important;
}

1 Like

Hi Teklabs,

Do you have a code that this only works in homepage, and not other pages?

also the arrow keeps black on me with your code, see picture below,

Thank you in advance,

1 Like
{% if template.name == "index" %}

{% endif %}
1 Like

Please try this code @Lisavdijk

1 Like

Hi Teklabs,

Many thanks, changed a bit to make it smoother upon scrolling and with my OCD level

but your code worked perfectly, appreciate your help with that.

{% if template.name == "index" %}

{% endif %}

Thank you for your time and support :slightly_smiling_face:

1 Like

another question, is it possible to put this country selector more to right on mobile?

it’s close to the logo, but i want to keep logo in center

1 Like

Can you try add more this code

1 Like

Hi Teklabs,

thank you once again, this also worked out perfectly :slightly_smiling_face:

appreciate your great support.

Kind regards,

Lisa,

1 Like