使用iframe的IE z-index问题

时间:2014-05-27 09:45:34

标签: html5 css3 internet-explorer z-index youtube-iframe-api

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

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

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;
        }

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:0)

我设法找到我必须添加到iframe的src的答案&amp; 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>