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();
});
});
});![Show your love with this adorable couples mending a broken heart key necklace set. One for each of you, to show that your love fits together perfectly. Comes in two color styles and the chain is 50cm long. This couples necklace is perfect for everyday use or to go to that fun party. Makes an awesome Valentine's gift.](//dragoyle.com/cdn/shop/products/6E8B4B20F42B5FDFAF1669680B6D418A.png?v=1673338966&width=1445)
![Show your love with this adorable couples mending a broken heart key necklace set. One for each of you, to show that your love fits together perfectly. Comes in two color styles and the chain is 50cm long. This couples necklace is perfect for everyday use or to go to that fun party. Makes an awesome Valentine's gift.](http://dragoyle.com/cdn/shop/products/F446F71D654B68957507F227E5E9A5A9.jpg?v=1673338599&width=1445)
![Show your love with this adorable couples mending a broken heart key necklace set. One for each of you, to show that your love fits together perfectly. Comes in two color styles and the chain is 50cm long. This couples necklace is perfect for everyday use or to go to that fun party. Makes an awesome Valentine's gift.](http://dragoyle.com/cdn/shop/products/1AB239D5C74DD45B9890A28DB2C96EC6.jpg?v=1673338966&width=1445)
![Show your love with this adorable couples mending a broken heart key necklace set. One for each of you, to show that your love fits together perfectly. Comes in two color styles and the chain is 50cm long. This couples necklace is perfect for everyday use or to go to that fun party. Makes an awesome Valentine's gift.](http://dragoyle.com/cdn/shop/products/6E8B4B20F42B5FDFAF1669680B6D418A.png?v=1673338966&width=1445)