What's your biggest current challenge? Have your say in Community Polls along the right column.

How can I have the header fill in on a scroll down? DAWN THEME

Solved

How can I have the header fill in on a scroll down? DAWN THEME

renssnce
Tourist
5 0 1

Hey there,

 

Website is: www.renssnce.com

 

On the home page as you can see the header is translucent. But once you start scrolling down it stays that white and is hard to see. How can I make it so that once a user scrolls past some number of pixels or past a section, it turns to black? So that its easy to read.

Thank you ❤️

Accepted Solution (1)

Moeed
Shopify Partner
6357 1722 2083

This is an accepted solution.

Hey @renssnce 

 

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 </body> tag

<script>
window.addEventListener("scroll", function() {
    const header = document.querySelector(".header-wrapper");
    if (window.scrollY > 150) {
        header.classList.add("scrolled");
    } else {
        header.classList.remove("scrolled");
    }
});
</script>
<style>
.header-wrapper.scrolled {
    background: black !important;
}
</style>

RESULT:

Moeed_0-1731564614731.png

 

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

 

Best Regards,
Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Boost Your Sales with Affiliate Marketing - UpPromote: Affiliate & Referral


View solution in original post

Replies 3 (3)

Moeed
Shopify Partner
6357 1722 2083

This is an accepted solution.

Hey @renssnce 

 

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 </body> tag

<script>
window.addEventListener("scroll", function() {
    const header = document.querySelector(".header-wrapper");
    if (window.scrollY > 150) {
        header.classList.add("scrolled");
    } else {
        header.classList.remove("scrolled");
    }
});
</script>
<style>
.header-wrapper.scrolled {
    background: black !important;
}
</style>

RESULT:

Moeed_0-1731564614731.png

 

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

 

Best Regards,
Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Boost Your Sales with Affiliate Marketing - UpPromote: Affiliate & Referral


renssnce
Tourist
5 0 1

Thank you sir I greatly appreciate it, have a good rest of your day

akshay_bhatt
Shopify Partner
115 11 13

Hi @renssnce ,

 

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 </body> tag

<script>
window.addEventListener("scroll", function() {
    const header = document.querySelector(".header-wrapper");
    if (window.scrollY > 150) {
        header.classList.add("scrolled");
    } else {
        header.classList.remove("scrolled");
    }
});
</script>
<style>
.header-wrapper.scrolled {
    background: black !important;
}
</style>

Got it! If you found my suggestions helpful, please consider liking or marking it as a solution.
Your feedback is appreciated! If you have any more questions or need further assistance, just let me know.

Thanks & Regards
Akshay Bhatt

- Need a Shopify Specialist?
- Custom Design | Advanced Coding | Store Modifications
Email us