这篇文章主要介绍了html元素遮挡flash详解示例
代码如下:
wmode参数:
transparent模式:可用z-index控制层级
opaque模式:可用z-index控制层级
window模式:flash层级在浏览器核心显示窗口之上,flash会盖住与他重合的html
情景1(可修改flash的wmode参数)
修改wmode属性为,transparent或opaque
DEMO如下:
代码如下:
html, body, object, embed{ padding: 0; margin: 0; }
.m-box { position: relative; }
.m-flash, .m-flash embed { width: 400px; }
.m-shadow { position: absolute; top: 0; left: 0; width: 100px; height: 100px; background-color: #ccc; }
http://www.aa.net/i/bookmark.swf">
http://www.aa.net/i/bookmark.swf">>
Jununx,欢迎您!--transparent
http://www.aa.net/i/bookmark.swf">
http://www.aa.net/i/bookmark.swf">>
Jununx,欢迎您!--opaque
情景2(不可修改flash的wmode参数)-- flash和你的iframe遮挡层在同一个页面
注:如果要兼容Safari、Opera,那么请直接告诉需求这个遮不了
DEMO如下:
代码如下:
html, body, object, embed{ padding: 0; margin: 0; }
.m-box { position: relative; }
.m-flash, .m-flash embed { width: 400px; }
.m-flash { position: relative; z-index: 1; }
.m-shadow { position: absolute; top: 0; left: 0; z-index: 2; width: 100px; height: 100px; background-color: #ccc; }
.m-shadow-txt { position: absolute; z-index: 2; }
.m-shadow-ifr { position: absolute; z-index: -1; width: 100%; height: 100%; opacity: 0; filter: alpha(opacity=0); }
http://www.aa.net/i/bookmark.swf">
http://www.aa.net/i/bookmark.swf">>
情景3(不可修改flash的wmode参数)-- flash是被一个iframe页面引入的
注:如果木有权限操作iframe页面,那么请直接告诉需求这个遮不了注:如果要兼容Safari、Opera,那么请直接告诉需求这个遮不了
DEMO页:
代码如下:
html, body, object, embed{ padding: 0; margin: 0; }
.m-box { position: relative; }
.m-flash { position: relative; width: 400px; height: 400px; z-index: 1; }
.m-shadow { position: absolute; top: 0; left: 0; z-index: 2; width: 100px; height: 100px; background-color: #ccc; }
.m-shadow-txt { position: absolute; z-index: 2; }
.m-shadow-ifr { position: absolute; z-index: -1; width: 100%; height: 100%; opacity: 0; filter: alpha(opacity=0); }
iframe页:
代码如下:
html, body, object, embed{ padding: 0; margin: 0; }
.ifr { position: absolute; z-index: 2; width: 100px; height: 100px; opacity: 0; filter: alpha(opacity=0); }
.m-flash { position: absolute; z-index: 1; width: 400px; }
http://www.aa.net/i/bookmark.swf">
http://www.aa.cn/i/bookmark.swf">>