javascript - How to disable horizontal screen of mobile phone in webapp developed with js
巴扎黑
巴扎黑 2017-07-05 10:49:37
0
4
983

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?

巴扎黑
巴扎黑

reply all(4)
曾经蜡笔没有小新

Lock screen orientation

我想大声告诉你

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.

黄舟

It’s best to just write a p.tips

Then use media lookup

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

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template