Every third Gallery element should have a different class

I want to create a gallery. But every third image should be bigger than the others. Is there a way to control it inside Content Block?

[[+idx:mod=`3`:eq=`0`:then=`extra-class`:else=``]]

Cool. I had to look up what the modulus was (it’s been too long since school), but now it’s clear.

BTW: Is there also a feature for the last item of a list? I don’t find one in the output modifier list. The first is easy with the idx number. But how to get the last? I don’t find a placeholder of the total amount of images in a gallery.

You can also use CSS – nth-of-type
Here’s a codepen showing various uses including last-of-type.

1 Like

The total number of images is only available in the wrapperTpl right now so it looks like you’ll need to use @lucy’s excellent suggestion for that. I have logged a feature request so we’ll report back when that’s added.

Yes this will work. I‘m using the Codyhouse framework and my first idea was not adding to much own custom CSS, but if there is no other way, why not. Thanks.

1 Like

Quick update, MoreGallery 1.16.0-pl now has access to the [[+image_count]] placeholder in the image tpls.