From c873f5de6649ac3f092b133015bed2292a37dc20 Mon Sep 17 00:00:00 2001 From: Jan Umbach Date: Tue, 28 May 2024 17:14:06 +0200 Subject: [PATCH] test --- assets/global.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/assets/global.js b/assets/global.js index b07b43e..eacbc5a 100644 --- a/assets/global.js +++ b/assets/global.js @@ -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"