我有一个以横向模式观看效果最佳的网站。我怎样才能拥有它,如果用户以横向模式加载网站,那就没问题,但如果以纵向模式加载,或者他们从横向模式旋转到纵向模式,则会弹出图像或其他内容,占据整个屏幕,要求他们旋转回景观?认为 Javascript/jQuery 可以做到这一点。
I have seen this done on my iPad with the Game Informer app where if the user opens the app in Portrait or rotates from Landscape to Portrait a opaque image pops up asking them to rotate back to landscape. [see iPad screenshot]
除了 jQuery/JS,您还可以使用带有样式化 div 容器的 CSS,该容器仅在设备处于纵向模式时显示。
您可以使用媒体查询来捕获方向
例子:
/* for all screens */
#info {display: none;}
/* only when orientation is in portrait mode */
@media all and (orientation:portrait) {
#info {
display: block;
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)