Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript how can i access these classes Reply To: how can i access these classes

#248923
gearheartstudio
Participant

Ah! Thanks, I knew about them but didn’t know that they functioned like that. Will that start with a 0 variable as well?

Also, my question is why aren’t my images populating. The loading image comes up fine, the grid sorts, but never loads in the actual images. At the end of the js, where the:


<script>
$(“.grid-item”).each(function () {
‘use strict’;
index1++;
$(this).attr(“data-src”, ‘contents/photos/width4/4-‘ + index1 + ‘.JPG’);
});
$(“.grid-item–height1”).each(function () {
‘use strict’;
index2++;
$(this).attr(“data-src”, ‘contents/photos/height1/1-‘ + index2 + ‘.JPG’);
});
</script>

when is use $(“img”) it’ll populate a few photos from only .grid-item, but none of the others and it just shows broken links for the others. So I figure I have to define the class itself, but then it does nothing.