pull/1/head
Jan Umbach 2024-05-28 17:14:06 +02:00
parent b9e436209a
commit c873f5de66
1 changed files with 5 additions and 3 deletions

View File

@ -1130,15 +1130,17 @@ class VariantSelects extends HTMLElement {
console.log('mediaGallery', mediaGallery);
// get the second image id
const galleryImages = mediaGallery.querySelectorAll('.thumbnail-list__item:nth-child(2)').dataset;
const galleryImages = mediaGallery.querySelectorAll('.thumbnail-list__item');
console.log('mediaGallery.dataset', mediaGallery.dataset);
for (const galleryImage of galleryImages) {
// if display is not none, then show the image
if (galleryImage.style.display !== 'none') {
console.log('galleryImage.dataset', galleryImage.dataset);
const target = galleryImage.target; // "template--22806669590804__main-38794319626516"
const target = galleryImage.dataset.target; // "template--22806669590804__main-38794319626516"
const targetId = target.split('__')[1]; // "main-38794319626516"
const targetIdSplit = targetId.split('-')[1]; // "38794319626516"