All things Shopify and commerce
This is the code I have in the theme.css (theme is w a r e h o u s e)
@media(min-width: 650px){
#shopify-section-announcement-bar {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 10;
}
#shopify-section-header {
padding-top: 38px;
top: 30px;
}
This makes the announcement bar sticky on desktop but not on mobile. How can I make the bar sticky on both mobile and desktop
Hello @EastMeetsWestUS ,
Try to use below css instead [Remove media query]
#shopify-section-announcement-bar {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 10;
}
#shopify-section-header {
padding-top: 38px;
top: 30px;
}
If still facing the same problem, please send me url to check in depth.
Thank you
Hi, this code works in terms of making the announcement bar sticky on BOTH mobile and desktop. However on mobile the announcement bar overlaps a bit - see attached
you will need to add some top margin on mobile to the header to prevent the overlap
With this code, there seems to be no separation coding for mobile or desktop. If I change the top margin, won't this effect how it looks on desktop?
so you would need a media query for mobile only:
#shopify-section-announcement-bar {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 10;
}
#shopify-section-header {
padding-top: 38px;
top: 30px;
}
@media (max-width:650px){
.header-selector(grab the selector for the header element){
margin-top:(value to eliminate the overlap)px;
}
}
I'm having the same issue, I've tried a variety of codes, the code below works perfectly for desktop, but not mobile.
I've attempted to include media codes, but no luck. I've tried all the codes above, but no luck. Please help 🙂
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024