Solved

How to make announcement bar sticky?

Mani8
New Member
10 0 0

Hi there,

 

So basically i have a announcement bar at the top of my page, and i would like to make this sticky, exactly like my header is currently, it sticks when you scroll down. would someone be able to help me with this?

 

Screenshot 2023-09-18 at 3.31.31 PM.png

Accepted Solution (1)
Moeed
Shopify Partner
3697 932 1166

This is an accepted solution.

Hey @Mani8 

 

Remove the previous code and add this new code.

 

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

<style>
header#SiteHeader {
    margin-top: 38px;
}
.announcement {
    position: fixed;
    top: 0 !important;
    z-index: 999 !important;
    overflow: visible !important;
    width: 100% !important;
}
</style>

RESULT:

Moeed_0-1695035763291.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 developer? Chat on WhatsApp


- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
- Your Coffee Tip and my code, A perfect blend. ❤️

View solution in original post

Replies 6 (6)

Moeed
Shopify Partner
3697 932 1166

Hey @Mani8 

 

Could you please provide your Store URL and, if applicable, the Password too? Your cooperation is greatly appreciated!

 

Best Regards,
Moeed

Need a Shopify developer? Chat on WhatsApp


- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
- Your Coffee Tip and my code, A perfect blend. ❤️
Mani8
New Member
10 0 0

messaged you

Moeed
Shopify Partner
3697 932 1166

Hey @Mani8 

 

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

<style>
.announcement {
    position: sticky !important;
    top: 0 !important;
    z-index: 9999999 !important;
}
</style>

RESULT:

Moeed_0-1695032066656.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 developer? Chat on WhatsApp


- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
- Your Coffee Tip and my code, A perfect blend. ❤️
Mani8
New Member
10 0 0

Thanks for the quick response. 

 

Its only sticky till the first element. Then scrolls over.Screenshot 2023-09-18 at 4.32.13 PM.png

Moeed
Shopify Partner
3697 932 1166

This is an accepted solution.

Hey @Mani8 

 

Remove the previous code and add this new code.

 

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

<style>
header#SiteHeader {
    margin-top: 38px;
}
.announcement {
    position: fixed;
    top: 0 !important;
    z-index: 999 !important;
    overflow: visible !important;
    width: 100% !important;
}
</style>

RESULT:

Moeed_0-1695035763291.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 developer? Chat on WhatsApp


- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
- Your Coffee Tip and my code, A perfect blend. ❤️
Mani8
New Member
10 0 0

Let me know next steps.