All things Shopify and commerce
Hi there,
Could someone please help me. Currently, customers have to click on a little button on the top left hand side of my product image for it to open. Is there a way I can make it open if they click on anywhere in the image? URL: https://salourlingerie.com/products/rochelle-bodysuit
My theme is drop.
Thanks!
Hi, yes. I think the simplest way is to add a custom JS snippet in some JS or the liquid file (theme.liquid).
<script>
document.querySelectorAll(".product__image").forEach((img) => {
img.addEventListener("click", () => {
document.querySelector(".js-zoom-btn").click();
});
});
</script>
Step 1: Go to Admin -> Online store -> Theme > Edit code
Step 2: Search for the file theme.liquid
Step 3: Add this code before </body> tag
<script>
document.addEventListener("DOMContentLoaded", (event) => {
const productGalleryContainers = document.querySelectorAll('.product-gallery__media-container');
if (productGalleryContainers.length) {
productGalleryContainers.forEach((productGalleryContainer) => {
const productImg = productGalleryContainer.querySelector('.product__image');
productImg.addEventListener('click', () => {
productGalleryContainer.querySelector('a.js-zoom-btn.product-gallery__zoom-btn').click();
});
});
}
});
</script>
B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.
B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.
B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.
BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now
In Canada, payment processors, like those that provide payment processing services t...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025