Placing a div in front of a flash embed

跟風遠走 提交于 2019-12-04 04:45:44

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; }

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 :)

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