I'm dynamically loading images in a grid, which displays images with a link to some lightbox. This is the way im currently doing it:
$(".selection_thumb").each( function(i) {
$(this).append("<a data-lightbox='image-1' href='img/folder/folder/"+(++i)+".jpg'><img src='img/folder/"+(++i)+".jpg' alt='alttext' /></a>");
});
But it seems to be loading this:
<a data-lightbox="image-1" href="img/folder/folder/1.jpg"><img src="img/folder/2.jpg" alt="alttext" /></a>
But it needs to be:
<a data-lightbox="image-1" href="img/folder/folder/1.jpg"><img src="img/folder/1.jpg" alt="alttext" /></a>
So it is loading different numbers 1 and 2 instead of 1 and 1.
Any help is appreciated