【问题标题】:Full screen video issue when using animate.css in Chrome在 Chrome 中使用 animate.css 时出现全屏视频问题
【发布时间】:2015-11-26 05:04:13
【问题描述】:

我有一个页面,其中包含使用视频标签的视频。此外,我的页面使用 animate.css 向我的元素添加一些动画。问题是当我在 animate.css 中使用样式时,我的视频无法正确全屏显示。这是我的页面示例:

<div id="wrapper">
    <div id="page-wrapper" class="gray-bg dashbard-1">
        <h2 id="sv_title">Here is some text for illustration</h2>

        <div class="animated fadeInRight">
            <video src="http://www.w3schools.com/html/mov_bbb.mp4" controls=""></video>
        </div>
    </div>
</div>

https://jsfiddle.net/p4nmt637/

另外,这个问题似乎只发生在 chrome 中,我在 FireFox 和 Safari 中测试过,我没有遇到这个问题。

【问题讨论】:

    标签: google-chrome video fullscreen animate.css


    【解决方案1】:

    这似乎是一个 Chrome 错误。问题是由设置为bothanimation-fill-mode 引起的。这使动画在视频父容器上保持活动状态,这似乎与全屏视频混淆。

    解决方法

    通过将其改回默认值none,我们修复了全屏问题。在此示例中,动画填充模式通过 .custom 类更改。

    示例

    this jsfiddle 中有一个工作示例。

    /*Uncomment the class to fix*/  
    
    /*
    .custom {
       animation-fill-mode: none;
    }
    */
    
    <link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.4.0/animate.css" rel="stylesheet" />
    <h2 id="sv_title">This is the problem, the bottom video is being layered over the top when this is made fullscreen. Uncomment the custom class to see it fix itself.</h2>
    <div class="animated fadeInRight custom">
      <video src="http://www.w3schools.com/html/mov_bbb.mp4" controls></video>
    </div>
       
    <div class="animated fadeInRight">
      <video src="http://www.w3schools.com/html/mov_bbb.mp4" autoplay muted></video>
    </div>
    

    【讨论】:

    • 这让我发疯了,我有带有动画祖先的视频 js 元素,页眉和页脚将在全屏模式下显示。谢谢
    • 我正要删除动画时发现它们会造成错误,直到我看到这个答案
    猜你喜欢
    • 2023-03-26
    • 1970-01-01
    • 2020-12-05
    • 2011-07-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多