I have a grid where images are dynamically loaded with a link to a lightbox. Currently, this is how I am achieving 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>");
});
However, the issue is that it is loading like this:
<a data-lightbox="image-1" href="img/folder/folder/1.jpg"><img src="img/folder/2.jpg" alt="alttext" /></a>
Instead of how it should be:
<a data-lightbox="image-1" href="img/folder/folder/1.jpg"><img src="img/folder/1.jpg" alt="alttext" /></a>
It seems to be loading different numbers 1 and 2 instead of 1 and 1.
Any assistance would be greatly appreciated