2009/08/04

如何安排 flash 與 div 的上下層次關係

I’m currently working on a site with the wonderful Hong Vo from Namaste Interactive that has an embedded flash video object on the home page. This site also has a horizontal drop-down menu. All was great until one of the drop down lists became long enough to overlap the flash video. Apparently, when embedding a flash video into an html page the embed code automatically puts the flash video on top of everything else. I could not for the life of me get the menu to lay behind the video no matter what I tried.

It was one of those “little problems” that was eating away my entire morning and most of my patience! ;o) In sadness, I discovered several forum discussions in which, apparently, it was agreed that there was simply nothing to be done.

Thankfully, I was stubborn and continued to dig further (I don’t give up easily!) and found this discussion, which contained a simple solution, which I will summarize for you:

  1. Wrap your flash content in a div
  2. Add
  3. to your object tag
  4. Set wmode=”transparent” in the embed tag
  5. Use css to set the position and z-index for your div (don’t set negative z-index values as it will make your flash disappear)


The CSS


#flash {
position: relative; /*or absolute*/
z-index: 0;
}

The XHTML


<div id="flash">
<object … >
<param name="wmode" value="transparent">
<embed … wmode="transparent">
</object>
</div>

沒有留言:

張貼留言

Web 技術中的 Session 是什麼?

轉載原文:  Web 技術中的 Session 是什麼? 本文目標 在 Web 的世界裡,Session 已經是被廣泛使用的一種技術,大多數的 Web 開發者,肯定都能運用自如。在現今的各類 Web 應用程式的開發框架和工具中,Session 也已經被包裝成容易使用的模...