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();
});
});
});![Forget the caterwauling and chaos of dog walking! With our Dog Safety Pants, your pup will be secure and stylish, giving you peace of mind! These snug security wraps feature a unique design, so your pup will look and feel as safe as houses.](//dragoyle.com/cdn/shop/products/4395469152748.jpg?v=1709056880&width=1445)
![Forget the caterwauling and chaos of dog walking! With our Dog Safety Pants, your pup will be secure and stylish, giving you peace of mind! These snug security wraps feature a unique design, so your pup will look and feel as safe as houses.](http://dragoyle.com/cdn/shop/products/5483903314408.jpg?v=1709056878&width=1445)
![Forget the caterwauling and chaos of dog walking! With our Dog Safety Pants, your pup will be secure and stylish, giving you peace of mind! These snug security wraps feature a unique design, so your pup will look and feel as safe as houses.](http://dragoyle.com/cdn/shop/products/3721530977712.jpg?v=1709056875&width=1445)
![Forget the caterwauling and chaos of dog walking! With our Dog Safety Pants, your pup will be secure and stylish, giving you peace of mind! These snug security wraps feature a unique design, so your pup will look and feel as safe as houses.](http://dragoyle.com/cdn/shop/products/2758189877501.jpg?v=1679881401&width=1445)
![Forget the caterwauling and chaos of dog walking! With our Dog Safety Pants, your pup will be secure and stylish, giving you peace of mind! These snug security wraps feature a unique design, so your pup will look and feel as safe as houses.](http://dragoyle.com/cdn/shop/products/1986740487768.jpg?v=1709056876&width=1445)
![Forget the caterwauling and chaos of dog walking! With our Dog Safety Pants, your pup will be secure and stylish, giving you peace of mind! These snug security wraps feature a unique design, so your pup will look and feel as safe as houses.](http://dragoyle.com/cdn/shop/products/4395469152748.jpg?v=1709056880&width=1445)