2014-10-03 57 views
0

我正在使用Galleria(http://galleria.io/)並動態生成圖像到圖庫,偶爾有一個圖庫只包含一個圖像的情況, d像畫廊出現沒有縮略圖容器,我怎麼能這樣做?如果Galleria只有一個圖像,則不要顯示縮略圖

任何幫助非常感謝!

我對初始化當前的腳本是:

Galleria.loadTheme('assets/js/galleria.classic.min.js'); 

// Initialize Galleria 
Galleria.run('#galleria', { 
    show: selectedIndex, 
    showInfo: false, 
    swipe: true, 
    imageCrop: false, 
    responsive:true, 
    showCounter:true, 
    thumbnails:true, 
    lightbox: true, 
    trueFullscreen:true, 
    extend: function() { 
    this.bind(Galleria.IMAGE, function() { 
     $('#description').html(this.$('info-title').html()); 
     $('.galleria-lightbox-title').html(this.$('info-title').html()); 
    }) 
    } 
}); 

回答

2

嘗試縮略圖:$( 「#廣場IMG」)的大小()> 1

+0

是的,這個工程,謝謝! – nikoka 2014-10-03 13:05:42

0
$('#galleria img:only-child').hide(); 

您需要選擇的子元素。當它只是單數時的父 - 一個縮略圖 - jQuery選擇器only-child允許這 - 然後鏈接到hide()隱藏它的聲明。

+0

雖然此代碼片段可能會解決問題,但[包括解釋](// meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers)確實有助於提高帖子的質量。請記住,您將來會爲讀者回答問題,而這些人可能不知道您的代碼建議的原因。也請儘量不要使用解釋性註釋來擠佔代碼,因爲這會降低代碼和解釋的可讀性! – FrankerZ 2018-01-30 06:07:23

+0

確定添加了說明 – neilgee 2018-01-30 09:40:11