Placing a div in front of a flash embed

本小妞迷上赌 提交于 2020-01-22 19:58:05

问题


I need to place a div tag above literally everything else on the page. I've read that setting wmode param to opaque will do it, but also heard that that will only effect IE. Is this true? How do you do it?


回答1:


In your flash applet tag, simply have this:

<object id='flashObject' ....>
    <param ....>
    <param name='wmode' value='opaque'>
    <embed ... wmode='opaque'>
    </embed>
</object>

That should take care of it.

Note that the downside of this is it slows down rendering for both the flash movie and page elements, but shouldn't be a problem in most cases.

Also, by including this as both an object param and an embed attribute, it works in all major browsers.

Edit, as per MidnightLighning's comment:

Once the flash object is prepared in this way, you need to float the div over the page, like so:

<body>
    <object> ... <!-- this is your flash movie --> </object>
    <div id="floater">The Floating Div</div>
</body>

Then create your CSS like this:

#flashObject { position:relative; z-index:1 }
#floater { position:absolute; z-index:100; top:0; left:0; }



回答2:


On my client site, I used html:

<div id="photo>
  <div id="flash"></div>
  <ul id="navigation">..</ul>
</div>

css:

#flash { z-index: 6; }
#navigation { z-index: 8; margin-top: -100px; }

and then I replace #flash with my flash swf with SWFObject ( http://code.google.com/p/swfobject )

So basically, z-index and some intelligent way to embed flash should work :)



来源:https://stackoverflow.com/questions/2111175/placing-a-div-in-front-of-a-flash-embed

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