[Resolved] Having code disable on tablet only

Home Forums Support [Resolved] Having code disable on tablet only

Home Forums Support Having code disable on tablet only

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #791838
    Matthew

    Hi there,

    I tried to see if this has been asked before but couldn’t find anything. I would like to have some code disable on tablet only.

    Its a WordPress widget so I can’t add a class to it to use “Using our hide-on-* classes” from docs.

    https://docs.generatepress.com/article/responsive-display/

    So I need to use @media however there isn’t an option for mobile and desktop, just one or the other.

    I tried writing the following:

    @media (max-width: 768px) and (min-width: 1025px) {
    	#text-2 {
    		display: none;
    	}
    }

    However, this didn’t work. The actual #text-2 part isn’t really relevant this bit works, its to do with the media query.

    Any ideas what I am doing wrong or I am completely on the wrong path?

    Cheers!

    #791888
    David
    Staff
    Customer Support

    Hi there,

    the media query is the wrong way round ie. @media (max-width: 1025px) and (min-width: 768px)

    #791910
    Matthew

    Ahh! I knew it would be something to do with the numbers. Was getting so confused.

    Cheers all sorted 🙂

    #792035
    David
    Staff
    Customer Support

    Haha easily done. Glad to be of help.

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