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();
});
});
});![Stay warm in style with this Forensic Science Streeter Hoodie Dress. Crafted with high-quality materials, this dress offers comfort and durability. It has a full-zip front and two hand pockets, perfect for keeping small items safe and secure.](//dragoyle.com/cdn/shop/products/3e1935bf27affdcf8fbe39b2deaa72b0.jpg?v=1680854759&width=1445)
![Stay warm in style with this Forensic Science Streeter Hoodie Dress. Crafted with high-quality materials, this dress offers comfort and durability. It has a full-zip front and two hand pockets, perfect for keeping small items safe and secure.](http://dragoyle.com/cdn/shop/products/63a863dd94020212ef99810e813f7ca1.jpg?v=1680854759&width=1445)
![Stay warm in style with this Forensic Science Streeter Hoodie Dress. Crafted with high-quality materials, this dress offers comfort and durability. It has a full-zip front and two hand pockets, perfect for keeping small items safe and secure.](http://dragoyle.com/cdn/shop/products/bbbafa6f3ff224ab3de19fd904854cad.jpg?v=1680854759&width=1445)
![Stay warm in style with this Forensic Science Streeter Hoodie Dress. Crafted with high-quality materials, this dress offers comfort and durability. It has a full-zip front and two hand pockets, perfect for keeping small items safe and secure.](http://dragoyle.com/cdn/shop/products/3e1935bf27affdcf8fbe39b2deaa72b0.jpg?v=1680854759&width=1445)