I am using Osvaldas Valutis' excellent imagelightbox.js script (http://osvaldas.info/image-lightbox-responsive-touch-friendly). It works fine, but it doesn't allow me to divide a bunch of images into separate galleries within the same page (it iterates ALL images).
I would like to have all images in the page to have the same data attribute (data-imagelightbox="b") so that they all display in the same way, but find a method to group them into separate galleries, so that when you open one image that belongs to a gallery of 3, it only iterates those 3 images, and then you can close this gallery, and open the next.
<div class="gallery-1">
<a href="images/big/a-1.png" data-imagelightbox="b" class="gal-1">thumb</a>
<a href="images/big/a-2.png" data-imagelightbox="b" class="gal-1">thumb</a>
<a href="images/big/a-3.png" data-imagelightbox="b" class="gal-1">thumb</a>
</div>
<div class="gallery-2">
<a href="images/big/b-1.png" data-imagelightbox="b" class="gal-2">thumb</a>
<a href="images/big/b-2.png" data-imagelightbox="b" class="gal-2">thumb</a>
<a href="images/big/b-3.png" data-imagelightbox="b" class="gal-2">thumb</a>
</div>
I assumed the best way to do this would be to use different selectors to separate images into galleries, for example:
var galleries = [ '.gal-1', '.gal-2', '.gal-3', '.gal-4' ];
$.each( galleries, function()
{
$( selector ).imageLightbox();
});
But the above code doesn't work (it throws an error "undefined selector") and keeps on opening the 6 images above in a complete sequence, instead of dividing them into two different sets...
Any ideas as to how to do this?
Thanks!