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 3 years ago by Avin.
    #115988
    Zed
    Cryout Creations mastermind

    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 check the available documentation and search the forums before starting a topic.
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Force menu to hide in mobile landscape mode’ is closed to new replies.