2011-05-30 44 views
1

我有這樣的代碼,依賴於Embedly API與視頻和縮略圖更換鏈接:顯示/隱藏使用jQuery時機加載動畫

$('a.oembed').each(function(){ 
    $(this).embedly({maxWidth:525,'method':'replace'}).bind('embedly-oembed', function(e, oembed){ 
     $(this).parent().append($("<img>", { src: oembed.thumbnail_url, width:200 })).children('img').wrap('<div class="thumbnail_border" />'); 
    }); 
}); 

我想在此請求顯示加載圖像製作,並在縮略圖返回時隱藏它。我將如何做到這一點?

我也有這樣的代碼隱藏的縮略圖,並顯示視頻:

$(".thumbnail_border img").live('click', function() { 

    $(this).toggle();  
    $(this).parent().hide(); 
    $(this).parent().parent().children('.embed').toggle(); 
    $(this).parent().parent().children("div.description_div").hide(); 

}); 

我想顯示加載圖片,當用戶點擊,我想一旦該視頻出現將其隱藏。我該怎麼做呢?

+0

考慮一個回調函數。 – daryl 2011-05-30 04:44:44

回答

0

使用回調作爲tfbox建議。使用以下的效果:

 
$("urdiv").fadeIn('slow'); and $("urdiv").fadeOut('slow') //see jquery docs for more info 

一些信息here