`;
imageInfo.variations.forEach((variation, index) => {
imagesHtml += `
`;
});
imagesHtml += '
';
imageContainer.innerHTML = imagesHtml;
imageContainer.classList.remove('hidden');
// Alternar imagens ao clicar no botão de troca
const swapButtons = document.querySelectorAll('.swap-button');
swapButtons.forEach(button => {
const index = button.getAttribute('data-variation-index');
const variation = imageInfo.variations[index];
let currentImageIndex = 0;
button.addEventListener('click', () => {
currentImageIndex = (currentImageIndex + 1) % variation.additionalImages.length;
const variationImage = button.previousElementSibling; // Atualiza a imagem da variação
variationImage.src = variation.additionalImages[currentImageIndex].url;
variationImage.style.width = `${variation.additionalImages[currentImageIndex].width}px`;
});
});
}
Escolha a frase desejada