Shopify themes, liquid, logos, and UX
how can I show the annoucement bar only on desktop not on mobile ?
thanks in advance
Solved! Go to the solution
This is an accepted solution.
Hi @Martin299,
change your code from
to
<style>
@media only screen and (max-width: 600px) {
.announcement-bar {
display: none;
}
}
@media only screen and (min-width: 601px) {
.announcement-bar {
display: flex!immportant;
justify-content: start!important;
}
}
</style>
If it helps you, please like and mark it as the solution.
Best Regards
B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.
B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.
B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.
BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now
This is an accepted solution.
Hi @Martin299,
change your code from
to
<style>
@media only screen and (max-width: 600px) {
.announcement-bar {
display: none;
}
}
@media only screen and (min-width: 601px) {
.announcement-bar {
display: flex!immportant;
justify-content: start!important;
}
}
</style>
If it helps you, please like and mark it as the solution.
Best Regards
B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.
B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.
B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.
BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now
The easiest way to do this is to use a CSS Media Query. You can find the CSS class for the announcement bar (this different by theme but it is usually something like .announcement-bar) and then use CSS to hide it on mobile.
Here's an example of some CSS you can use inside of the custom liquid section or in your custom css settings for the announcement bar.
@media screen and (max-width: 391px){
.announcement-bar{
display: none;
}
}
In the example above I have hidden the announcement bar on screen sizes 391px and smaller. This would allow it to be hidden on most mobile phones but there are some phone screens that are bigger than 391px so you might need to use a higher pixel number to cover all the options.
The only other things to watch out for here is the class used for your theme's announcement bar. You will need to look into your theme's code and see what the announcement bar's class is so you can make changes to it.
If you're not sure what I'm talking about when I say what "class" your announcement bar is using, you can google "What are CSS Classes" and you should see a few examples of what you should be looking for.
Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024