Flash和zindex

今天在做一个页面,要求通过一个按钮显示/隐藏一个flash。放置两个position是absolute的div,把flash放在其中一个div里,修改这个div的z-index,发现flash始终在前面。

于是Google,找到http://www.askapache.com/css/getting-flash-to-show-up-in-front-of-content.html 。原来flash有一个参数“wmode”,可选三个值:Window ,Opaque,Transparent,默认为“Window”,

官方解释:

wmode attribute/parameter
Values:

  1. Window
  2. Opaque
  3. Transparent

The default value is Window if this attribute is omitted. Applies to object only.

Description:
(Optional) Lets you use the transparent Flash content, absolute positioning, and layering capabilities available in Internet Explorer 4.0.

Window plays the application in its own rectangular window on a web page. Window indicates that the Flash application has no interaction with HTML layers and is always the topmost item.

Opaque makes the application hide everything behind it on the page.

Transparent makes the background of the HTML page show through all the transparent portions of the application and can slow animation performance.

Opaque windowless and Transparent windowless both interact with HTML layers, letting layers above the SWF file block out the application. The difference between the two is that Transparent allows transparency so that HTML layers below the SWF file might show through if a section of the SWF file has transparency; opaque does not.

  解决方法:在flash的Object中加一个参数:<param name="wmode" value="Opaque"/>即可通过z-index控制flash所在层。

原文地址:https://www.cnblogs.com/amonw/p/1823096.html