【问题标题】:IE z-index issue with iframeiframe 的 IE z-index 问题
【发布时间】:2014-07-16 04:08:16
【问题描述】:

我有一个 Youtube 视频 iframe 覆盖整个窗口(100% 宽度和高度),我让其余元素在视频上滚动。 在 Chrome 和 Firefox 上一切正常,但 IE 似乎没有响应 z-index。

我在这里创建了一个 jsFiddle http://jsfiddle.net/RickyStam/42tLS/,您可以在其中看到问题。

HTML

    <div class="page-container">
        <div>
            <div class="header">
                <a href="/index.aspx"><img src="Images/logo.png" /></a>
                <div class="menu-container">
                    <ul>
                        <li><a href="#">solutions</a></li>
                        <li><a href="#">about us</a></li>
                        <li><a href="#">contact</a></li>
                    </ul>
                </div>
                <div class="clear"></div>
            </div>
            <div class="video-container">
                <iframe class="video-player" src="//www.youtube.com/embed/7x8BCbo45qA?autoplay=0&showinfo=0&controls=0" wmode="Opaque" frameborder="0" allowfullscreen></iframe>
                <div class="video-container-text">
                    <h1 class="regularfonts">LOREM IPSUM LOREM IPSUM LOREM IPSUM LOREM IPSUM</h1>
                    <p>LOREM IPSUM LOREM IPSUM LOREM IPSUM LOREM IPSUM</p>
                </div>
            </div>
        </div>
        <div style="width: 100%; height: 685px; z-index: 12"></div>
        <div class="aboutus-container">
            <h1>ABOUT US</h1>
            <p>LOREM IPSUM LOREM IPSUM LOREM IPSUM LOREM IPSUMLOREM IPSUM LOREM IPSUM LOREM IPSUM LOREM IPSUM</p>
            <p>
                LOREM IPSUM LOREM IPSUM LOREM IPSUM LOREM IPSUM LOREM IPSUM LOREM IPSUM LOREM IPSUM LOREM IPSUM<br />
                LOREM IPSUM LOREM IPSUM LOREM IPSUM LOREM IPSUM
            </p>
            <p>LOREM IPSUM LOREM IPSUM LOREM IPSUM LOREM IPSUM</p>
        </div>
    </div>

CSS

.page-container {
        width: 100%;
    }

    .header {
        background: black;
        height: 80px;
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 11;
    }

    .video-container {
        position: fixed;
        top: 0;
        width: 100%;
        height: 100%;
        z-index: -1;
        text-align: center;
    }

    .video-player {
        width: 100%;
        height: 100%;
    }

    .video-container-text {
        position: absolute;
        top: 0px;
        width: 100%;
        height: 100%;
        background-image: url('../Images/check_black.png');
        padding-top: 200px;
        box-sizing: border-box;
    }

        .video-container-text h1 {
            font-size: 18px;
            padding: 20px 30px;
            background-image: url('../Images/check_black.png');
            border-left: 2px solid #cf0103;
            border-right: 2px solid #cf0103;
            display: inline-block;
        }



    .aboutus-container {
        height: 270px;
        background: #292929;
        text-align: center;
        position: relative;
        z-index: 10;
    }

        .aboutus-container h1 {
            font-size: 25px;
            display: inline-block;
            margin-top: 45px;
            margin-bottom: 20px;
        }

任何帮助将不胜感激!

【问题讨论】:

标签: html css internet-explorer z-index youtube-iframe-api


【解决方案1】:

我设法找到了我必须添加到 iframe 的源代码的答案 &wmode=opaque

这是完整的 iframe:

<iframe class="video-player" src="//www.youtube.com/embed/7x8BCbo45qA?autoplay=0&showinfo=0&controls=0&wmode=opaque" wmode="Opaque" frameborder="0" allowfullscreen></iframe>

【讨论】:

    猜你喜欢
    • 2014-08-31
    • 2011-08-14
    • 2012-10-21
    • 1970-01-01
    • 1970-01-01
    • 2011-09-12
    • 1970-01-01
    • 1970-01-01
    • 2011-10-02
    相关资源
    最近更新 更多