【问题标题】:IE-8 iframe and flash object ignores z-index?IE-8 iframe 和 flash 对象忽略 z-index?
【发布时间】:2011-08-24 08:23:54
【问题描述】:

我有以下 div,我正在尝试在 my_flash 前面制作 iframe 层。 这是一个常见问题,我已经阅读了所有我能找到的解决方案,但我仍然在 IE8 中遇到问题。顺便说一句,我正在使用 SWFobject。

来源:

<script type="text/javascript">
swfobject.embedSWF("index.swf", "my_flash", "100%", "100%", "8.0.0");
swffit.fit("my_flash",900,650);
</script>

<div id="my_flash" style="z-index:1;"></div>

<div  style="border:none; overflow:hidden; width:50px; height:21px; z-index:9999; position: absolute; bottom: 5px; left: 110px;" >
<iframe src="http://www.facebook.com/plugins/like.php?blah.html" scrolling="no" frameborder="0" allowTransparency="true"  style="z-index:9998"/>
</div>

【问题讨论】:

    标签: flash iframe internet-explorer-8 z-index swfobject


    【解决方案1】:

    很遗憾,z-index 不会影响 Flash Player。看这个例子:http://demos.learnswfobject.com/html-over-swf/dynamic.html(相关tutorial

    在上面链接的示例中,父元素具有position:"relative",HTML 元素具有position:"absolute"。 SWF 不需要指定position。所有元素都没有指定z-index。 SWF 需要将wmode 设置为opaquetransparentwmode:"opaque" 优于 wmode:"transparent",因为已知 transparent 会导致问题并使用比 opaque 更多的处理能力。

    试试这个:

    <style type="text/css"> 
    /* establish relationship with child elements */
    #wrapper { position: relative; }
    
    /* this element will automatically appear overtop 
       of the wmode=opaque SWF without needing z-index */
    #myiframe { position: absolute; }
    
    /* No CSS needs to be specified for the SWF */
    #myswf { }
    </style>
    
    <div id="wrapper"> 
        <iframe id="myiframe" src="mypage.html"></iframe> 
        <div id="myswf">This will be replaced by SWFObject</div> 
    </div> 
    

    【讨论】:

      【解决方案2】:

      使用 SWFObject 嵌入时,应设置 Flash 对象的 wmode 参数。

      Here 是一个简短的教程。

      这是针对您的问题的修改代码:

      <script type="text/javascript">
        swfobject.embedSWF("index.swf", "my_flash", "100%", "100%", "8.0.0", null, { wmode: "transparent" });
        swffit.fit("my_flash",900,650);
      </script>
      

      【讨论】:

        【解决方案3】:
        var flashvars = {};
        var params = {};
        params.wmode = "transparent";
        var attributes = {};
        
        swfobject.embedSWF("index.swf", "my_flash", "100%", "100%", "8.0.0", '/swfobject/expressInstall.swf',
            flashvars, params, attributes);
        

        【讨论】:

          猜你喜欢
          • 2013-01-01
          • 1970-01-01
          • 2011-01-22
          • 2014-07-16
          • 2014-08-31
          • 2014-02-13
          • 2012-02-22
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多