2009-09-26 61 views
0

我有一個VIMEO閃光物體隱藏,像這樣爲什麼這個克隆不能與ie一起工作,但它與Firefox呢?

CSS:

#banner-vid-link div.object, #mainVideo, #blackSheet { 
    display: none; 
} 

HTML:

<div id="banner-vid-link"> 
    <img src="thumbnail.png" /><br />Watch This! 
    <div class="object"> 
      <object width="700" height="394"><youget the idea /></object> 
    </div> 
</div> 

而當你點擊縮略圖,會彈出使用jQuery視頻:

 $('#banner-vid-link').click(function(){ 
      newVideo = $(this).children().children('object'); 
      $('#blackSheet').fadeIn('slow', function(){ 
       $('#mainVideo').html(newVideo); // put the video in the box 
       $('#mainVideo').fadeIn().children().fadeIn(); // fadein the 
mainVideo box, and fadeIn the object inside mainVideo 
      }); 
    }); 

blackSheet是一個全屏覆蓋和#mainVideo s它很好地在中間與以下css

現在上面的代碼 - 在firefox和safari中都可以正常工作。但在IE7 ie7(尚未嘗試任何其他窗口設置),但由於某種原因,它的錯誤。它看起來mainVideo沒有填充newVideo變量 - 它只是加載屏幕覆蓋,就是這樣。

本來我是使用以下行jQuery的克隆():

newVideo = $(this).children().children('object').clone(true); 

但我讀的地方,即可能不喜歡克隆非常多,或者以不同方式處理,以FF和Safari。有或沒有克隆,它仍然工作在FF但不是。

這裏我的邏輯失敗是什麼?

回答

2

它看起來像你正在採取一個DOM元素(newVideo),並使用它在另一個元素(mainVideo)上設置HTML,而不實際引用其HTML。

我認爲append()功能可能會更好地考慮你想要完成的工作。

嘗試以下操作:

newVideo = $(this).children().children('object').clone(true); 
$("#mainVideo").empty().append(newVideo); 
+0

你的FF作品建議,但不是IE瀏覽器...也許有一些disasterously錯我的CSS .. – willdanceforfun 2009-09-26 06:13:06

+0

事實證明,它不喜歡我克隆或追加對象。如果我追加包裝Div它在ie中工作。 – willdanceforfun 2009-09-26 06:25:51

+0

也許這與對象元素有關。 – 2009-09-26 12:14:24

相關問題