Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/435.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 禁用AMP站点中的横向模式_Javascript_Amp Html - Fatal编程技术网

Javascript 禁用AMP站点中的横向模式

Javascript 禁用AMP站点中的横向模式,javascript,amp-html,Javascript,Amp Html,由于我们无法在AMP中添加自定义JavaScript或事件侦听器,有没有可能阻止AMP站点中的横向模式?根据我的说法,您不能通过网站更改操作系统行为 您可以使用css媒体查询技巧,在横向模式下使用css显示纵向视图 <style amp-custom> @media screen and (min-width: 320px) and (max-width: 767px) and (orientation: landscape) { html { transform: ro

由于我们无法在AMP中添加自定义JavaScript或事件侦听器,有没有可能阻止AMP站点中的横向模式?

根据我的说法,您不能通过网站更改操作系统行为

您可以使用css媒体查询技巧,在横向模式下使用css显示纵向视图

<style amp-custom>
@media screen and (min-width: 320px) and (max-width: 767px) and (orientation: landscape) {
  html {
    transform: rotate(-90deg);
    -ms-transform: rotate(-90deg); /* IE 9 */
    -webkit-transform: rotate(-90deg); /* Chrome, Safari, Opera */
    transform-origin: left top;
    width: 100vh;
    overflow-x: hidden;
    position: absolute;
    top: 100%;
    left: 0;
  }
}
</style>

@媒体屏幕和(最小宽度:320px)和(最大宽度:767px)和(方向:横向){
html{
变换:旋转(-90度);
-ms变换:旋转(-90度);/*IE 9*/
-webkit变换:旋转(-90度);/*铬合金、Safari、Opera*/
变换原点:左上;
宽度:100vh;
溢出x:隐藏;
位置:绝对位置;
最高:100%;
左:0;
}
}