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

How can I make my header and announcement bar sticky on scroll?

Solved

How can I make my header and announcement bar sticky on scroll?

Ivnvu
Excursionist
22 0 3

Hi guys,

 

I'd like to make the header and announcement bar sticky on scroll on my page. I know this has been asked a lot but I can't seem to get it to work for my store (using Local theme). 

 

Does anyone have an input?

 

Store: https://gryningens.myshopify.com/

 

I'd like to achieve the same as on this site: https://www.mathem.se/ ,i.e,. the header follows along on scroll up and down.

 

Thank you so much

Accepted Solution (1)

PageFly-Henry
Shopify Partner
1184 335 292

This is an accepted solution.

Hi @Ivnvu 

 

This is Henry from PageFly - Landing Page Builder App

 

You can try this code by following these steps: 

Step 1: Go to Online Store->Theme->Edit code.

Step 2: Search file theme.css

Step 3: Paste the below code at bottom of the file -> Save

 

div#shopify-section-sections--19397825560915__header {

    position: sticky;

    z-index: 999;

    top: 0;

}

 

div#shopify-section-sections--19397825560915__announcement { 

    position: sticky;

    z-index: 999;

    top: 41%;

}

 

Hope that my solution works for you.

Best regards,

Henry | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!


PageFly - #1 Page Builder for Shopify merchants.


All features are available from Free plan. Live Chat Support is available 24/7.

View solution in original post

Replies 5 (5)

PageFly-Henry
Shopify Partner
1184 335 292

This is an accepted solution.

Hi @Ivnvu 

 

This is Henry from PageFly - Landing Page Builder App

 

You can try this code by following these steps: 

Step 1: Go to Online Store->Theme->Edit code.

Step 2: Search file theme.css

Step 3: Paste the below code at bottom of the file -> Save

 

div#shopify-section-sections--19397825560915__header {

    position: sticky;

    z-index: 999;

    top: 0;

}

 

div#shopify-section-sections--19397825560915__announcement { 

    position: sticky;

    z-index: 999;

    top: 41%;

}

 

Hope that my solution works for you.

Best regards,

Henry | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!


PageFly - #1 Page Builder for Shopify merchants.


All features are available from Free plan. Live Chat Support is available 24/7.

UmioNails
Visitor
1 0 0

can't find the file theme.css

shall i just edit the file theme.liquid under layout? and copy, paste the above codes?

vincy66
Visitor
1 0 0

Hi Henry,

i tried your code, but it didn't work for my store(www.e-hemm.com), can you help me, please?

ZenoPageBuilder
Shopify Partner
1052 203 227

Hello @Ivnvu 👋

Inside Shopify Admin, you can go to Edit theme code, open file theme.css (or theme.css.liquid) and add this code at the bottom

#shopify-section-sections--19397825560915__header {
    position: sticky;
    top: 0;
    z-index: 9999;
}

The header should be sticky like this

Screenshot 2023-09-22 at 17.46.49.png

Hope that helps! 

Zeno Page Builder - Build responsive & SEO-optimized Landing pages, Blog posts, Product pages and more...
Learn more at zenobuilder.com
EdisonCLS
Shopify Partner
13 0 0

Hi there,

 

Could you also help with our website: www.canadianliquorstore.ca

 

Regards,

Edison