tags:

views:

621

answers:

2

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?

A: 

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; }
Ipsquiggle
I tried that, it didn't work :-\
Webnet
Did you then use `position:absolute;` to position your DIV over the Flash element? The above code preps the Flash element correctly, but you then need to put the DIV over it; perhaps assign a `z-index` to the <object> containing the Flash element, and the DIV that goes over it?
MidnightLightning
@Webnet: What didn't work exactly? Was the flash still rendering over top of the div? Was the div not positioning correctly? Trimming your page down to a minimum example that demonstrates the problem and posting the code would be a big help.
Ipsquiggle
A: 

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

Adam Kiss