IE-8 iframe and flash object ignores z-index?

六眼飞鱼酱① 提交于 2019-12-01 06:47:47

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> 

You should set the wmode parameter of the Flash object when embedding with SWFObject.

Here is a short tutorial to do that.

Here is a modified code for your problem:

<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>
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);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!