Javascript Don';如果Galleria只有一张图片,则不显示缩略图

Javascript Don';如果Galleria只有一张图片,则不显示缩略图,javascript,jquery,galleria,Javascript,Jquery,Galleria,我正在使用Galleria()并动态地向图库生成图像,偶尔会出现图库只包含一个图像的情况,此时我希望图库显示时没有缩略图容器,我该怎么做 非常感谢您的帮助 我当前用于初始化的脚本是: Galleria.loadTheme('assets/js/galleria.classic.min.js'); // Initialize Galleria Galleria.run('#galleria', { show: selectedIndex, showInfo: false, swipe

我正在使用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());
    })
  }
}); 
尝试缩略图:$(“#galleria img”).size()>1


当父元素是单数时,您需要选择它的子元素-一个缩略图-jQuery选择器
only child
允许-然后将语句链接到
hide()
以隐藏它。

虽然这个代码片段可以解决问题,但确实有助于提高文章的质量。请记住,您将在将来回答读者的问题,这些人可能不知道您的代码建议的原因。还请尽量不要用解释性注释挤满您的代码,因为这会降低代码和解释的可读性!
 $('#galleria img:only-child').hide();