2009-04-25 27 views
1

這裏是我的代碼:Flash重疊的ThickBox在Internet Explorer

我有我的頁面上的Flash幻燈片。我已經使用thickbox進行登錄,但是當有人點擊登錄名時,flash會覆蓋thickbox。

我已經設法解決Firefox上的問題,但似乎沒有任何工作在Internet Explorer上。

回答

1

您需要使用以下屬性之一才能使Flash「位於」DOM內部而不是其上。

WMODE =透明 - 或 - WMODE =不透明

自帶打破多項功能的缺點。

+0

不幸的是,我試過了,它似乎沒有工作。 :(謝謝你的回覆。 – cssnoob 2009-04-25 15:55:28

1

消費者是正確的,但他沒有多說明。 wmode是嵌入swf時在html中設置的屬性,它需要設置爲透明。所以,如果你使用AC_RunActiveContent你作爲參數添加到"wmode", "transparent"嵌入功能,或者在swfoject你添加so.addVariable("wmode", "transparent");

1

我有以下Flash對象相同的問題:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="690" height="400" id="tech" align="middle"> 
      <param name="allowScriptAccess" value="sameDomain" /> 
      <param name="movie" value="banner/banner.swf?xml_path=banner/slides.xml" /> 
      <param name="quality" value="high" /> 
      <param name="wmode" value="opaque" /> 
      <embed src="banner/banner.swf?xml_path=banner/slides.xml" quality="high" width="690" height="400" name="tech" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />                

     </object> 

注意行<param name="wmode" value="opaque" /> 這是使其工作的關鍵。

希望它可以幫助你。

再見

1
在thickbox.js

文件,你可以使用這個:「抓」之前

SEACH爲tb_show功能,並以「試試看」的末尾加上這樣的:

$('object').each(function(){ this.regDisplay=this.style.display; this.style.display='none'; })

$('#TB_window object').each(function(){ this.style.display=this.regDisplay; })

搜索的一個tb_remove功能,並返回前補充一點:

$('object').each(function(){ this.style.display=this.regDisplay; })

1

三分球的答案非常有效的頁面上的所有閃存項目。

的一個tb_remove功能

$('object').each(function(){ this.style.display=this.regDisplay; }) 

的代碼應該放在裏面

j("#TB_window").fadeOut("fast",function(){ 
... 
}); 

這樣,它只是淡出後出現,而不是瞬間......

1

OK, 後2天的搜索網絡的答案我已經找到了一個純JS功能,它可以解決它在所有瀏覽器!

你去:

function fix_flash() { 
    // loop through every embed tag on the site 
    var embeds = document.getElementsByTagName('embed'); 
    for (i = 0; i < embeds.length; i++) { 
     embed = embeds[i]; 
     var new_embed; 
     // everything but Firefox & Konqueror 
     if (embed.outerHTML) { 
      var html = embed.outerHTML; 
      // replace an existing wmode parameter 
      if (html.match(/wmode\s*=\s*('|")[a-zA-Z]+('|")/i)) 
       new_embed = html.replace(/wmode\s*=\s*('|")window('|")/i, "wmode='transparent'"); 
      // add a new wmode parameter 
      else 
       new_embed = html.replace(/<embed\s/i, "<embed wmode='transparent' "); 
      // replace the old embed object with the fixed version 
      embed.insertAdjacentHTML('beforeBegin', new_embed); 
      embed.parentNode.removeChild(embed); 
     } else { 
      // cloneNode is buggy in some versions of Safari & Opera, but works fine in FF 
      new_embed = embed.cloneNode(true); 
      if (!new_embed.getAttribute('wmode') || new_embed.getAttribute('wmode').toLowerCase() == 'window') 
       new_embed.setAttribute('wmode', 'transparent'); 
      embed.parentNode.replaceChild(new_embed, embed); 
     } 
    } 
    // loop through every object tag on the site 
    var objects = document.getElementsByTagName('object'); 
    for (i = 0; i < objects.length; i++) { 
     object = objects[i]; 
     var new_object; 
     // object is an IE specific tag so we can use outerHTML here 
     if (object.outerHTML) { 
      var html = object.outerHTML; 
      // replace an existing wmode parameter 
      if (html.match(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")[a-zA-Z]+('|")\s*\/?\>/i)) 
       new_object = html.replace(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")window('|")\s*\/?\>/i, "<param name='wmode' value='transparent' />"); 
      // add a new wmode parameter 
      else 
       new_object = html.replace(/<\/object\>/i, "<param name='wmode' value='transparent' />\n</object>"); 
      // loop through each of the param tags 
      var children = object.childNodes; 
      for (j = 0; j < children.length; j++) { 
       try { 
        if (children[j] != null) { 
         var theName = children[j].getAttribute('name'); 
         if (theName != null && theName.match(/flashvars/i)) { 
          new_object = new_object.replace(/<param\s+name\s*=\s*('|")flashvars('|")\s+value\s*=\s*('|")[^'"]*('|")\s*\/?\>/i, "<param name='flashvars' value='" + children[j].getAttribute('value') + "' />"); 
         } 
        } 
       } 
       catch (err) { 
       } 
      } 
      // replace the old embed object with the fixed versiony 
      object.insertAdjacentHTML('beforeBegin', new_object); 
      object.parentNode.removeChild(object); 
     } 
    } 
} 

現在你可以只運行在加載網頁時使用jQuery:

$(document).ready(function() { 
      fix_flash();  
} 
1

簡單的方式來做到這一點。僅在IE9和FIREFOX上測試。

Mani's Solution

  1. 總結您的Flash內容在一個div
  2. 添加到您的對象標記
  3. 設置的wmode = 「透明」,在嵌入標籤
  4. 使用CSS來設置的位置和z - 你的div索引(不要設置負Z指標值,因爲它會讓你的閃光燈消失)

的CSS

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

的XHTML

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

而且,摩尼的話......就是這樣!