4,114
edits
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
Line 34: | Line 34: | ||
// Store image information in an array | // Store image information in an array | ||
var images = []; | // Store image information in an array | ||
var images = []; | |||
// Loop through possible image containers | |||
for (var i = 1; i <= imageCount; i++) { | |||
var imageContainer = $(this).find('.image' + i); | |||
// Check if the image container exists | |||
if (imageContainer.length > 0) { | |||
var image = { | |||
link: imageContainer.find('a').attr('href'), | |||
src: imageContainer.find('img').attr('src'), | |||
alt: imageContainer.find('img').attr('alt'), | |||
caption: imageContainer.find('.caption-image' + i).text() | |||
}; | |||
// Add the image to the array | |||
images.push(image); | |||
} else { | |||
// Break the loop if no more images are found | |||
break; | |||
} | |||
} | |||
// Now images array contains the information of available images | |||
console.log('Number of images:', images.length); | |||
for (var i = 0; i < images.length; i++) { | |||
console.log('Image ' + i + ':', images[i]); | |||
} | |||
// Initial image to display | // Initial image to display |