IE-8的iframe和flash对象忽略z-index? [英] IE-8 iframe and flash object ignores z-index?
问题描述
我有下面的div,我正在尝试使my_flash的iframe层在infront之前。
这是一个常见的问题,我已经通读了所有我能找到的解决方案,但仍然在IE8中遇到问题。
以下是源代码:
< 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_flashstyle =z-index:1;>< / div>
< div style =border:none; overflow:hidden; width:50px; height:21px; z-index:9999; position:absolute; bottom:5px; left:110px; >
< / div>
不幸的是,z-index不会影响Flash Player。看到这个例子: http://demos.learnswfobject.com/html-over-swf /dynamic.html (相关教程<在上面的例子中,父元素有 position:relative
,而HTML元素有位置:绝对
。 SWF不需要指定 position
。没有任何元素具有指定的 z-index
。 SWF需要将 wmode
设置为 opaque
或透明
。 wmode:opaque优于
wmode:transparent
作为透明
已知会导致问题,并使用比 opaque
更多的处理能力。试试这个:
< style type =text / css>
/ *建立与子元素的关系* /
#wrapper {position:relative; }
$ b $ / *这个元素会自动出现在wmode =不透明的SWF的
之上而不需要z-index * /
#myiframe {position:absolute; }
/ *不需要为SWF指定CSS * /
#myswf {}
< / style>
< div id =wrapper>
< iframe id =myiframesrc =mypage.html>< / iframe>
< div id =myswf>这将被SWFObject< / div>替换
< / div>
I have the following divs and I'm trying to make the iframe layer infront of my_flash. It's a common problem and I've read through all the solutions I could find and still I'm getting issues in IE8. I'm using SWFobject by the way.
Here's the source:
<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>
Unfortunately, z-index does not affect Flash Player. See this example: http://demos.learnswfobject.com/html-over-swf/dynamic.html (Related tutorial)
In the example linked above, the parent element has position:"relative"
, and the HTML element has position:"absolute"
. The SWF doesn't need to have position
specified. None of the elements has z-index
specified. The SWF needs to have wmode
set to either opaque
or transparent
. wmode:"opaque"
is preferred to wmode:"transparent"
as transparent
is known to cause issues and use much more processing power than opaque
.
Try this:
<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>
这篇关于IE-8的iframe和flash对象忽略z-index?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!