1
我们的网站上有一个移动网页,当浏览器加载时,它总是需要在横向上呈现。此外,页面需要横向锁定,以便设备无法更改方向。如何强制移动网页加载横向
是否有任何JS API在主要的移动浏览器或CSS属性,将完成此?
我们的网站上有一个移动网页,当浏览器加载时,它总是需要在横向上呈现。此外,页面需要横向锁定,以便设备无法更改方向。如何强制移动网页加载横向
是否有任何JS API在主要的移动浏览器或CSS属性,将完成此?
您可以尝试使用此代码:
#container { display:block; }
@media only screen and (orientation:portrait){
#container {
height: 100vw;
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
}
@media only screen and (orientation:landscape){
#container {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
你也应该将其添加到身体标记:
<BODY id="container">
我发现这个解决方案here。同样的博客还提供了额外的建议,但我没有尝试过,因为上面的一个很好运行
在这里检查http://stackoverflow.com/questions/14360581/force-landscape-orientation-mode – Jaypee
可能重复的[部队]景观“方向模式](http://stackoverflow.com/questions/14360581/force-landscape-orientation-mode) – War10ck