移动网站 - 仅限强制横向/不自动旋转 [英] Mobile site - force landscape only / no auto-rotate

查看:213
本文介绍了移动网站 - 仅限强制横向/不自动旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站有移动样式表:

I have a site that has a mobile stylesheet:

<link rel="stylesheet" href="css/mobile.css" media="handheld">

我也使用jQuery来检查移动设备并相应地改变功能。

I'm also using jQuery to check for mobile devices and alter functionality accordingly.

但我想知道是否有一种方式强制仅景观定向和禁用自动旋转?

But I want to know if there is a way to force landscape-only orientation and disable auto-rotate? Either a CSS or a jQuery solution would be fine.

推荐答案

使用媒体查询测试方向,在纵向样式表中隐藏所有内容,并显示一条消息,表示该应用程序仅适用于横向模式。

Use media queries to test the orientation, in the portrait stylesheet hide everything and show a message that the app only works on landscape mode.

<link rel="stylesheet" type="text/css" href="css/style_l.css" media="screen and (orientation: landscape)">
<link rel="stylesheet" type="text/css" href="css/style_p.css" media="screen and (orientation: portrait)">

我认为最好的aproach

I think is best aproach

这篇关于移动网站 - 仅限强制横向/不自动旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆