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();
});
});
});![An adorable I Love You Magic Temperature Changing Mug that makes a great gift for the love in your life for Valentine's day, anniversary, birthday or any special occasion. This cool mug changes from cute hearts to I love you when a hot drink is poured into the cup.](//dragoyle.com/cdn/shop/products/7D7E12319A80B53B229719DDFB5F1A74.jpg?v=1673918204&width=1445)
![An adorable I Love You Magic Temperature Changing Mug that makes a great gift for the love in your life for Valentine's day, anniversary, birthday or any special occasion. This cool mug changes from cute hearts to I love you when a hot drink is poured into the cup.](http://dragoyle.com/cdn/shop/products/70566CCB8CC3EB26C983308E77EDA622.jpg?v=1673918211&width=1445)
![An adorable I Love You Magic Temperature Changing Mug that makes a great gift for the love in your life for Valentine's day, anniversary, birthday or any special occasion. This cool mug changes from cute hearts to I love you when a hot drink is poured into the cup.](http://dragoyle.com/cdn/shop/products/D50EE375903B80351F579280B38AC166.jpg?v=1673918209&width=1445)
![An adorable I Love You Magic Temperature Changing Mug that makes a great gift for the love in your life for Valentine's day, anniversary, birthday or any special occasion. This cool mug changes from cute hearts to I love you when a hot drink is poured into the cup.](http://dragoyle.com/cdn/shop/products/7D7E12319A80B53B229719DDFB5F1A74.jpg?v=1673918204&width=1445)