Shopify themes, liquid, logos, and UX
Hi there,
so basically i have created a custom announcement bar underneath my navigation bar, and i would like to make this sticky, exactly like my header is currently, it sticks when you scroll down. would someone be ab to help me with this?
i have created this on a copy of my theme, so i have provided you with a preview of the theme version a it is currently not live.
https://u36iylroi4rtgx25-29567713340.shopifypreview.com
Solved! Go to the solution
This is an accepted solution.
@media screen and (max-width: 640px)
div#sticky-atc- {
top: 0 !important;
}
@joshualev
Hii,
first change header file css
then after this css
then after show your result
Please Add these codes
#shopify-section-header {
top: 80px !important;
}
Add this css at the bottom of Online Store->Theme->Edit code->Assets->theme.scss.liquid
#shopify-section-announcement-bar {
position: sticky;
z-index: 999;
top: 40px;
}
@oscprofessional hi there i meant the custom announcement bar i made beneath the navigation bar, not the one above! could you still help me with this please?
div#sticky-atc- {
position: sticky;
top: 11em;
}
Add this css at the bottom of Online Store->Theme->Edit code->Assets->theme.scss.liquid
@oscprofessional thankyou this works perfectly on desktop however it is not working correctly on mobile, would you mind looking at this for me?
It's working in mobile view.
But your store header is not sticky on mobile view.
Make you header sticky, then It will look fine.
Surely I will help you but I need to check the code in your theme files, So you have to give me the store access so that I will check and let you the solution for this work.
solution will be tested on all the mobile devices. It is a time-consuming task.
please connect with us via email or what's app.
we will discuss there further.
Have a nice day!
@oscprofessional would you not be able to do this via source code? with the preview i sent?
Hey @joshualev ,
Source code appears totally different from liquid code, So I cannot do this only with source code.
@oscprofessional no problem i will ask my boss if it is okay to give you read only access and get back to you?
You can get connected to me on skype or what's app.
@oscprofessional without giving you access, would you be able to get the bar to stick to the top of the screen on mobile without the header and nav bar appearing if you understand what im trying to say?
@media screen and (min-width: 640px) {
div#sticky-atc- {
top: 0;
}
}
Add this css at the bottom of Online Store->Theme->Edit code->Assets->theme.scss.liquid
Please like my all post and accept it.
@oscprofessional when i add this to the bottom of the style code in dg-flash-infos.liquid it doesnt not work, plus it removes the sticky off the desktop version
@media screen and (max-width: 640px) {
div#sticky-atc- {
top: 0;
}
}
Add this css at the bottom of Online Store->Theme->Edit code->Assets->theme.scss.liquid
This is an accepted solution.
@media screen and (max-width: 640px)
div#sticky-atc- {
top: 0 !important;
}
@oscprofessional thankyou for the help mate it works now! i will be in touch if i need any more assistance! have a great day!
Your Most Welcome!
Please like my post 🙂
@oscprofessional i have noticed one issue, if you refresh the page beneath the bar itself there is an svg icon the flashes and appears for about 0.5 seconds and then disapears do you know why?
@oscprofessional can you see this message after i've accepted this as the solution?
Please connect me on Skype.
Hey @joshualev ,
Welcome to the Shopify community!
You can follow the instruction below:
#shopify-section-announcement-bar {
position: sticky;
top: 0;
z-index: 9;
}
#shopify-section-header {
top:35px;
}
If you feel like my answer is helpful, please mark it as a solution. Let me know if you have any further questions.
Thank you!
Raman
@ReturnPrime hi there i meant the custom announcement bar i made beneath the navigation bar, not the one above! could you still help me with this please?
just add the class sticky
id="sticky-atc-{{ section.id }}"
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025