document.addEventListener('DOMContentLoaded', function () {
// Get the product images container
var productMedia = document.querySelectorAll('.product-single__media-item');
// Get the variant dropdown or buttons
var variantSelectors = document.querySelectorAll('[name="id"]');
// Function to display the first product image
function showFirstImage() {
if (productMedia.length > 0) {
productMedia.forEach(function (media, index) {
if (index === 0) {
media.style.display = 'block';
} else {
media.style.display = 'none';
}
});
}
}
// Show the first image on page load
showFirstImage();
// Add event listeners to variant selectors
variantSelectors.forEach(function (selector) {
selector.addEventListener('change', function () {
showFirstImage();
});
});
});
document.addEventListener('DOMContentLoaded', function () {
// Get the product images container
var productMedia = document.querySelectorAll('.product-single__media-item');
// Get the variant dropdown or buttons
var variantSelectors = document.querySelectorAll('[name="id"]');
// Function to display the first product image
function showFirstImage() {
if (productMedia.length > 0) {
productMedia.forEach(function (media, index) {
if (index === 0) {
media.style.display = 'block';
} else {
media.style.display = 'none';
}
});
}
}
// Show the first image on page load
showFirstImage();
// Add event listeners to variant selectors
variantSelectors.forEach(function (selector) {
selector.addEventListener('change', function () {
showFirstImage();
});
});
});
document.addEventListener('DOMContentLoaded', function () {
// Get the product images container
var productMedia = document.querySelectorAll('.product-single__media-item');
// Get the variant dropdown or buttons
var variantSelectors = document.querySelectorAll('[name="id"]');
// Function to display the first product image
function showFirstImage() {
if (productMedia.length > 0) {
productMedia.forEach(function (media, index) {
if (index === 0) {
media.style.display = 'block';
} else {
media.style.display = 'none';
}
});
}
}
// Show the first image on page load
showFirstImage();
// Add event listeners to variant selectors
variantSelectors.forEach(function (selector) {
selector.addEventListener('change', function () {
showFirstImage();
});
});
});
document.addEventListener('DOMContentLoaded', function () {
// Get the product images container
var productMedia = document.querySelectorAll('.product-single__media-item');
// Get the variant dropdown or buttons
var variantSelectors = document.querySelectorAll('[name="id"]');
// Function to display the first product image
function showFirstImage() {
if (productMedia.length > 0) {
productMedia.forEach(function (media, index) {
if (index === 0) {
media.style.display = 'block';
} else {
media.style.display = 'none';
}
});
}
}
// Show the first image on page load
showFirstImage();
// Add event listeners to variant selectors
variantSelectors.forEach(function (selector) {
selector.addEventListener('change', function () {
showFirstImage();
});
});
});
document.addEventListener('DOMContentLoaded', function () {
// Get the product images container
var productMedia = document.querySelectorAll('.product-single__media-item');
// Get the variant dropdown or buttons
var variantSelectors = document.querySelectorAll('[name="id"]');
// Function to display the first product image
function showFirstImage() {
if (productMedia.length > 0) {
productMedia.forEach(function (media, index) {
if (index === 0) {
media.style.display = 'block';
} else {
media.style.display = 'none';
}
});
}
}
// Show the first image on page load
showFirstImage();
// Add event listeners to variant selectors
variantSelectors.forEach(function (selector) {
selector.addEventListener('change', function () {
showFirstImage();
});
});
});![Indulge in the luxury of 18 exquisite glass jars, each with a charming cork stopper. Perfect for storing and displaying your cherished herbs and oils, these jars are a must-have for any witch crafting enthusiast.](//dragoyle.com/cdn/shop/files/Sd9d83e2fe08c4084a29ccbed0d4c02bbJ.webp?v=1735348146&width=1445)
![Indulge in the luxury of 18 exquisite glass jars, each with a charming cork stopper. Perfect for storing and displaying your cherished herbs and oils, these jars are a must-have for any witch crafting enthusiast.](http://dragoyle.com/cdn/shop/files/S2dbfb50b5d6d4ed2b202d53868a84246k.webp?v=1735348023&width=1445)
![Indulge in the luxury of 18 exquisite glass jars, each with a charming cork stopper. Perfect for storing and displaying your cherished herbs and oils, these jars are a must-have for any witch crafting enthusiast.](http://dragoyle.com/cdn/shop/files/Sbeaf280b70bf4ac98c62715c509367baD.webp?v=1735348051&width=1445)
![Indulge in the luxury of 18 exquisite glass jars, each with a charming cork stopper. Perfect for storing and displaying your cherished herbs and oils, these jars are a must-have for any witch crafting enthusiast.](http://dragoyle.com/cdn/shop/files/S622e467457414181993a33468d25b5f3F.webp?v=1735348083&width=1445)
![Indulge in the luxury of 18 exquisite glass jars, each with a charming cork stopper. Perfect for storing and displaying your cherished herbs and oils, these jars are a must-have for any witch crafting enthusiast.](http://dragoyle.com/cdn/shop/files/Sc842f1d9a1914e4db6d68b3359896f9aR.webp?v=1735348115&width=1445)
![Indulge in the luxury of 18 exquisite glass jars, each with a charming cork stopper. Perfect for storing and displaying your cherished herbs and oils, these jars are a must-have for any witch crafting enthusiast.](http://dragoyle.com/cdn/shop/files/Sd9d83e2fe08c4084a29ccbed0d4c02bbJ.webp?v=1735348146&width=1445)