[Support request] How to hide the sidebar only in mobile view

Home Forums Support [Support request] How to hide the sidebar only in mobile view

Home Forums Support How to hide the sidebar only in mobile view

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #620088
    Zipeng

    I want to disable my right sidebar on the mobile view only. and show up at the desktop view. How can I do that?

    #620112
    David
    Staff
    Customer Support

    Hi there,

    you can use this CSS:

    @media (max-width: 768px) {
        #right-sidebar {
            display: none;
        }
    }
    #1695687
    ROHART

    Hi David,

    I want the same thing. I add the css code on my blog my-wildlife.com but it doesn’t work. Any idea why ?

    Gregory

    #1696052
    David
    Staff
    Customer Support

    Hi there,

    where are you adding the CSS ?

    #1697583
    ROHART

    Hi David,

    On the “additionnal css” menu (it’s a transmation of my french menu so the english name can be a little bit different) = > ../wp-admin/customize.php?url=https%3A%2F%2Fwww.my-wildlife.com%2Fparc-ornithologique-de-pont-de-gau%2F

    #1697780
    Ying
    Staff
    Customer Support

    Hi there,

    As far as I can tell, the sidebar is gone on mobile.

    Have you cleared your browser cache?

    Let me know 🙂

    #1698353
    ROHART

    Yes, I cleared the browser cache.
    On mobile, the sidebar is under the central part of my articles.

    You can check for example on the article https://www.my-wildlife.com/ou-faire-un-safari-au-kenya/

    Gregory

    #1698596
    David
    Staff
    Customer Support

    Aah now i can see the CSS – the problem is this comment:

    // pas de sidebar en mode mobile

    Its an invalid comment for CSS and will break any code that comes after it.

    CSS comments have to be wrapped in /* */

    So it should be:

    /* pas de sidebar en mode mobile */

    #1698626
    ROHART

    Thanks David for your help. It works and I learned something today.

    #1698959
    David
    Staff
    Customer Support

    You’re welcome.

    As a note:

    // this comment is fine for PHP and Javascript

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.