nikoka
nikoka

Reputation: 141

Don't show thumbnails if Galleria has only one image

I'm using Galleria (http://galleria.io/) and generating images to the gallery dynamically, once in a while there's a situation where a gallery includes just one image, at that point I'd like the gallery to appear without the thumbnail container, how could I do this?

Any help greatly appreciated!

My current script for initializing is:

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());
    })
  }
}); 

Upvotes: 1

Views: 717

Answers (2)

neilgee
neilgee

Reputation: 538

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

You need to select the child element of the parent when it is only singular - one thumbnail - the jQuery selector only-child allows this - then chain the statement to hide() to hide it.

Upvotes: 0

Giacomo Negretti
Giacomo Negretti

Reputation: 89

Try thumbnails: $("#galleria img").size()>1

Upvotes: 2

Related Questions