Have your say in Community Polls: What was/is your greatest motivation to start your own business?

how can I show the annoucement bar only on desktop not on mobile ?

Solved

how can I show the annoucement bar only on desktop not on mobile ?

Martin299
Excursionist
30 1 8

how can I show the annoucement bar only on desktop not on mobile ?
thanks in advance
0000000000.PNG

Accepted Solution (1)

BSSCommerce-B2B
Shopify Partner
1969 564 566

This is an accepted solution.

Hi @Martin299
change your code from

BSSCommerceB2B_1-1722789580396.png

 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

View solution in original post

Replies 2 (2)

BSSCommerce-B2B
Shopify Partner
1969 564 566

This is an accepted solution.

Hi @Martin299
change your code from

BSSCommerceB2B_1-1722789580396.png

 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

pierrewebdev
Shopify Partner
40 1 10

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.

I just launched a community for Shopify Developers and anyone looking to learn Shopify Development. If you're interested in becoming a Shopify Developer or leveling up your skills, join the community.
https://www.skool.com/shopify-dev-hub-5821