【发布时间】:2011-06-19 09:32:03
【问题描述】:
结合使用 HTML 和 JS,如何检测设备是横向还是纵向,然后相应地更改嵌入视频的大小?
我知道检测屏幕方向的一种相当简单的方法是将宽度与高度进行比较,看看哪个更大。但是我怎么能在代码中使用这些变量来嵌入视频呢?代码来自 Vimeo:
<iframe src="http://player.vimeo.com/video/15813517?title=0&byline=0&portrait=0" width="320" height="480" frameborder="0"></iframe><p><a href="http://vimeo.com/15813524" rel="external">RCE: A Different Kind of Experience</a> from <a href="http://vimeo.com/user3163610">John D. Low</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
【问题讨论】:
-
我记得 iPhone(3 和 3GS)报告其屏幕宽度为 480 像素无论其方向如何。顺便说一句,您可能会阅读这个问题,看看那里是否有任何有用的信息:Can JS/jQuery determine the orientation of the iPhone?
标签: html video mobile orientation