如何在移动网络应用程序中锁定 ipad 横向方向
谁能告诉我如何在移动网络应用程序中锁定横向的 ipad 方向。即使翻转也不应该旋转为纵向。
function reorient(e) {
var portrait = (window.orientation % 180 != 0);
$("body").css("-webkit-transform", !portrait ? "rotate(90deg)" : "");
alert("hi");
}
window.onorientationchange = reorient;
window.setTimeout(reorient, 0)
我尝试了这些代码,但它只影响设计。在我的情况下它应该翻转
can anyone tel how to lock ipad orientation in landscape for mobile webapps. even if it flip it should not rotate into portrait.
function reorient(e) {
var portrait = (window.orientation % 180 != 0);
$("body").css("-webkit-transform", !portrait ? "rotate(90deg)" : "");
alert("hi");
}
window.onorientationchange = reorient;
window.setTimeout(reorient, 0)
i tried these code but it affecting only the design . where as in my case it should flip
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用媒体查询控制两个方向的 CSS
Lèse majesté 在这里对此问题写了一个很好的答案,其中涉及使用 jquery 来对抗旋转: 阻止移动网页上的设备旋转
You could control the CSS in both orientations with a media query
Lèse majesté wrote a good answer to this question here which involves countering the rotation with jquery: Blocking device rotation on mobile web pages