search

Home  >  Q&A  >  body text

javascript - How to disable horizontal screen of mobile phone in webapp developed with js

Using js to develop a webapp, the leader requires that it can only be viewed when the mobile phone is in portrait mode and not in landscape mode. How to prohibit the mobile phone in landscape mode?

巴扎黑巴扎黑2700 days ago960

reply all(4)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-07-05 10:51:37

    Lock screen orientation

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-07-05 10:51:37

    For WeChat, it seems that it can be achieved by calling their API, but other browsers are not able to do so at this stage. But you can make a prompt asking users to turn their phones horizontally, which is a better solution.

    reply
    0
  • 黄舟

    黄舟2017-07-05 10:51:37

    It’s best to just write a p.tips

    Then use media lookup

    @media screen and (orientation:landscape) {
        .tips{
            display:block;
        }
        /*  内容就隐藏  */
        .container{
            display:none
        }
    }

    reply
    0
  • 黄舟

    黄舟2017-07-05 10:51:37

    What is the so-called prohibition? What effect is to be achieved?

    reply
    0
  • Cancelreply