2013-08-29 14 views
0

我創建了一個colorbox,它工作正常。問題是,當我關閉它並在頁面上打開一個不同的colorbox時,兩個colorbox都會加載(第一個colorboxes在第二個後面)。當我關閉它們,並打開另一個,我得到三個彩盒等。Colorbox載入所有以前的彩盒

我在Drupal 7視圖中這樣做,我將彩色鏈接添加到所有圖像字段。

我對調用colorboxes代碼:( '意見場場畫廊圖像點域,內容中的img')。

每個$(函數(){

nid = $(this).parent().parent().parent().find('.views-field-nid .field-content').html(); 
    href = $(this).attr('href'); 
    //$(this).attr('href', 'gallery-slideshow/' + nid +'?width=500&height=500&iframe=true'); 
    href = 'gallery-slideshow/' + nid; 
    $(this).colorbox({href: href}); 
    //$(this).attr('href', 'http://www.cnn.com?width=500&height=500&iframe=true'); 
    //$(this).addClass('colorbox-load init-colorbox-load-processed cboxElement'); 
}); 
+0

請你描述爲什麼使用此代碼 你可以考慮自己打開這個顏色框改寫輸出 ?請寫下您需要的功能。然後我可能會幫助你獲得所需的結果。 – Aniruddhsinh

回答

0

使用這在你彩盒:

var x = $(this).colorbox({onClosed: function(){ x.remove(); }});