我知道6年前也有一个类似的问题,但没有答案,我目前正在处理同样的问题.

Angular/Ironic应用程序中的Issue:<video>标签覆盖了我的图像和iOS Mobile Safari - no matter what I do!中的两个按钮

它适用于我测试过的所有其他浏览器,但不适用于iOS移动Safari.

html:

<ion-row style="height: 87vh; background: black">
        <ion-col style="height: 100%" size="12">
          <div class="outside_home">
            <video playsinline [muted]="true" loop id="video" height="100%" autoplay>
              <source src="{{homeInfo().videoUrl}}" type="video/mp4">
              <source src="{{homeInfo().videoUrl}}" type="video/webm">
              <source src="{{homeInfo().videoUrl}}" type="video/mov">
            </video>
            <div class="inside">
              <ion-grid>
                <ion-row class="ion-text-center ion-justify-content-center">
                  <ion-col size-xs="12" size-sm="10" size-md="8" size-lg="7" size-xl="6">
                    <picture>
                      <source type="image/webp">
                      <img [ngSrc]="homeInfo().homePageTitle" priority="true" alt="" style="min-height: 80px; display: block"
                           width="" height="">
                    </picture>
                  </ion-col>
                </ion-row>
                <ion-row class="ion-text-center">
                  <ion-col size-sm="6" class="ion-text-sm-end" size-xs="12">
                    <div style="padding-right: 3%; padding-left: 3%">
                      <ion-button fill="outline" class="video_text" (click)="navigateToPage('connect')">
                        Connect
                      </ion-button>
                    </div>
                  </ion-col>
                  <ion-col size-sm="6" class="ion-text-sm-start" size-xs="12">
                    <div style="padding-left: 3%; padding-right: 3%">
                      <ion-button fill="outline" class="video_text" (click)="navigateToPage('directions')">
                        Join in Person
                      </ion-button>
                    </div>
                  </ion-col>
                </ion-row>
              </ion-grid>
            </div>
          </div>
        </ion-col>
      </ion-row>

视频本身是一个.mov文件.

这是我的CSS:

div.outside_home {
  display: flex;
  position: absolute;
  width: 100%;
  min-height: 87vh;
  vertical-align: middle;
  justify-content: center;
}

div.inside {
  width: 100%; /* Can be in percentage also. */
  height: auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

我真的不知道还能做什么--我try 过添加overflow: visiblez-index位置,但什么也没有.

enter image description here

文本背后的视频正在播放-我刚刚拍了一张屏幕上没有人时的照片-但你可以看到IMG和它应该是什么的文本.这就是它通常看起来的样子.

在iOS移动狩猎中,imgbuttons根本不会显示-它显示为brief second,然后消失.奇怪的是,即使屏幕上的按钮不可见,您仍然可以点击它们??我不知道如果有人能帮忙那就太好了.

我感谢所有帮助!

推荐答案

为了确保iOS Mobile Safari上Angular/Ironic应用程序中的元素上方的按钮可见并可单击:

Css:

div.outside_home {
    display: flex;
    position: absolute;
    width: 100%;
    min-height: 87vh;
    vertical-align: middle;
    justify-content: center;
    z-index: 1;   //Changes added

    video {   //Changes added
        position: absolute;
        top: 0;
        left: 0;
        min-width: 100%;
        min-height: 100%;
        z-index:-10;
      }
  }

  div.inside {
    width: 100%; 
    height: auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }

HTML:

 <ion-row style="height: 87vh; background: black">
      <ion-col style="height: 100%" size="12">
        <div class="outside_home" >
          <video playsinline [muted]="true" loop id="video" height="100%" autoplay>
            <source src="https://amazonaws.s3.SampleVideoCheck.mp4" type="video/mp4">
            <source src="https://amazonaws.s3.SampleVideoCheck.mp4" type="video/webm">
            <source src="https://amazonaws.s3.SampleVideoCheck.mp4" type="video/mov">
          </video>
          <div class="inside">
            <ion-grid>
              <ion-row class="ion-text-center ion-justify-content-center">
                <ion-col size-xs="12" size-sm="10" size-md="8" size-lg="7" size-xl="6">
                  <picture>
                    <source type="image/webp">
                    <img src="https://www.gstatic.com/webp/gallery/1.sm.jpg" priority="true" alt="" style="min-height: 80px; display: block"
                         width="" height="">
                  </picture>
                </ion-col>
              </ion-row>
              <ion-row class="ion-text-center">
                <ion-col size-sm="6" class="ion-text-sm-end" size-xs="12">
                  <div style="padding-right: 3%; padding-left: 3%">
                    <ion-button fill="outline" class="video_text" (click)="navigateToPage('connect')">
                      Connect
                    </ion-button>
                  </div>
                </ion-col>
                <ion-col size-sm="6" class="ion-text-sm-start" size-xs="12">
                  <div style="padding-left: 3%; padding-right: 3%">
                    <ion-button fill="outline" class="video_text" (click)="navigateToPage('directions')">
                      Join in Person
                    </ion-button>
                  </div>
                </ion-col>
              </ion-row>
            </ion-grid>
          </div>
        </div>
      </ion-col>
    </ion-row>

这种CSS调整确保视频停留在其他内容之后,允许按钮可见和可点击.

希望这对你有帮助!如果您需要更多帮助,请随时询问.

Angular相关问答推荐

身份验证卫士给了我17个Angular 的任何类型

声明Angular material 中按钮的自定义 colored颜色

在Angular 为17的独立零部件中使用@NGX-平移

如何解决在StackBlitz中使用SPARTIER时出现无法解析解析器错误(&C)?

Angular 懒惰地加载一个服务

显示用户名-Angular

我需要取消订阅路由的可观察事件吗

从 Angular 应用程序中删除散列标签后无法从 Apache 访问 API

错误:在@angular/core中找不到导出ɵivyEnabled(导入为ɵivyEnabled)

为什么 AngularFire .set() 永远等待响应并且不继续?

Rxjs Observable:仅为第一个订阅者获取 HTTP 数据,为其余订阅者获取缓存数据

根据变量值更改按钮样式

将环境变量传递给Angular 库

错误:formControlName 必须与父 formGroup 指令一起使用.您需要添加一个 formGroup 指令

Angular url加号转换为空格

Angular 6在输入键上添加输入

如何在项目中导入 Angular material?

Firestore 从集合中获取文档 ID

如何从materialAngular使用分页器?

如何使用 @ngrx/store 获取 State 对象的当前值?