pull/1/head
Jan Umbach 2024-05-27 21:57:42 +02:00
parent e37450eaab
commit 70323723c3
1 changed files with 8 additions and 2 deletions

View File

@ -1050,9 +1050,15 @@ class VariantSelects extends HTMLElement {
document.querySelectorAll('[thumbnail-alt-mobile]').forEach((thumbnail) => {
console.log(thumbnail.getAttribute('thumbnail-alt-mobile'));
if (thumbnail.getAttribute('thumbnail-alt-mobile') === this.currentVariant.featured_image.alt) {
thumbnail.style.display = 'block';
// check if has class "is-active" to show the image
if (thumbnail.classList.contains('is-active') === false) {
thumbnail.classList.add('is-active');
}
} else {
thumbnail.style.display = 'none';
// check if has class "is-active" to hide the image
if (thumbnail.classList.contains('is-active') === true) {
thumbnail.classList.remove('is-active');
}
}
}
);