Force menu to hide in mobile landscape mode

  • Author
    Posts
  • #115907

    Hi, I’ve created a staging site and would like to hide the menu in landscape mode when the website is viewed using a mobile browser. You’ll need a passcode to enter.
    https://imgur.com/lgV4nBn

    Currently tested with a Samsung S20+ on Android 11 with chrome version 89.0.4389.105

    • This topic was modified 1 month ago by Avin.
    #115988
    Zed
    Cryout Creations Team

    Hi,

    There is no perfect CSS method of targeting browsers depending on the medium they run on (mobile/table/desktop). Generally, CSS is able to target devices depending on screen size: https://stackoverflow.com/questions/6370690/media-queries-how-to-target-desktop-tablet-and-mobile
    Browser detection is usually done with JS or through code, and even then it isn’t perfect since browser useragent strings can be manipulated.

    For a mobile device in landscape mode you’d want to target a screen size between the largest portrait mode you want the menu to remain visible on and the smallest desktop you’d also want a menu visible one. This approach is bound to overlap some less common situations (like tables in portrait mode or ultra portable laptops).


    If you like our creations, help us share by rating them on WordPress.org.
    Please read the available documentation and search the forums before posting.
Viewing 2 posts - 1 through 2 (of 2 total)

You need to log in to reply to this topic.