shopify-guides

Transform Your Shopify Product Page: Stacked & Sticky Images for Enhanced UX

Shopify theme.liquid file in code editor with custom script
Shopify theme.liquid file in code editor with custom script

Transform Your Shopify Product Page: Stacked & Sticky Images for Enhanced UX

As a Shopify store owner, you're constantly looking for ways to make your products shine and provide an exceptional shopping experience. One common desire is to move beyond the standard product image slider and present all product photos stacked vertically and sticky on desktop. This layout is a fantastic way to enhance the customer experience, letting shoppers see every angle at a glance without endless clicking or swiping, keeping the product visuals in view as they scroll through descriptions and reviews.

This topic recently sparked a great discussion in the Shopify community, initiated by @redmustang82. They were using a “free Canyon theme” and wanted to disable the JavaScript-controlled slider to achieve this stacked, sticky layout. As @tim_tairli pointed out, “Canyon” is often a renamed version of a popular free theme like Dawn, which is important because Dawn themes offer some great built-in flexibility. The core challenge here is that JavaScript often overrides simple CSS changes, making it tricky to implement this kind of visual tweak.

First Stop: Check Your Theme Settings (The Easiest Path!)

Before you even think about custom code, always, always check your theme customizer. Many modern Shopify themes, especially Dawn and its derivatives, offer built-in layout options for your product media. This is the cleanest and most update-proof method.

How to Check Your Theme Settings:

  1. Go to your Shopify Admin: Online Store > Themes.
  2. Click Customize on your active theme.
  3. Navigate to a Product Page (you might need to select “Products” from the top dropdown menu in the customizer).
  4. In the left sidebar, click on the Product information section.
  5. Look for “Media” or “Product media” options. You might find dropdowns or radio buttons for different layouts, such as “Thumbnail carousel,” “Stacked,” or “Column.”
  6. If you find a “Stacked” or similar option, select it. Also, look for a checkbox or setting related to “Enable sticky media” or “Sticky scroll.”
  7. Save your changes and preview your product page.

As @namphan highlighted in the thread with a screenshot, these options can often solve the problem without any coding. If your theme provides these settings, you're all set!

When Customizer Isn't Enough: Diving into Code

If your theme (or its specific version) doesn't offer the desired stacked and sticky layout directly in the customizer, you'll need to implement custom code. The primary hurdle, as Daniel_Mark correctly identified, is that the product gallery's JavaScript often overrides simple CSS. This means we need a solution that can either disable the JS slider or forcefully override its styles.

Important Precaution: Before making any code edits, always duplicate your theme. This creates a backup, allowing you to revert easily if anything goes wrong.

Option 1: Injecting CSS/JS via `theme.liquid` (The Comprehensive Override)

This method, suggested by @topnewyork, involves adding a script to your `theme.liquid` file. This script dynamically injects CSS and attempts to disable the slider component's JavaScript behavior. It's a more aggressive override, suitable when simpler CSS isn't enough.

How to Implement:

  1. Go to your Shopify Admin: Online Store > Themes.
  2. Click Actions > Edit Code on your duplicated theme.
  3. Search for the theme.liquid file in the Layout directory.
  4. Scroll to the very bottom of the file and paste the following code just before the closing tag:

This script first injects a block of CSS that forces images to stack, removes slider controls, and applies sticky positioning. The `!important` flags are crucial for overriding existing theme styles. Then, it attempts to disable the `slider-component` by setting its `data-slider-active` attribute to `false`, which often tells the theme's JavaScript to stop managing it as a slider.

Option 2: Custom CSS for Sticky & Stacked Layout (Simpler Approach)

If the JavaScript slider isn't too aggressive, or if you've managed to disable it through other means (e.g., modifying `main-product.liquid` or `product-media-gallery.liquid` as `Daniel_Mark` suggested), then pure CSS might suffice. This method is less intrusive and often preferred.

You can add these CSS snippets either to your theme's `base.css` file or, for themes like Dawn, directly into the “Custom CSS” field available within the Theme Customizer for specific sections.

Method A: Adding to `base.css` (or `theme.scss.liquid`)
  1. Go to your Shopify Admin: Online Store > Themes.
  2. Click Actions > Edit Code on your duplicated theme.
  3. Find Assets > base.css (or `theme.scss.liquid`, `base.css`, etc., depending on your theme's structure).
  4. Paste the following code at the bottom of the file:
@media screen and (min-width: 990px) {
  .product__media-wrapper .product__column-sticky {
    position: sticky;
    top: 30px !important; /* Adjust this value as needed */
  }
  .product__media-list .product__media-item {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 2rem; /* Add spacing between images */
  }
  .slider-buttons, .slider-counter, .product__media-icon {
    display: none !important; /* Hide slider controls */
  }
}

The `top: 30px` value can be adjusted to control how far from the top of the viewport your sticky images start. @devcoders provided a similar snippet focusing on the sticky part.

Method B: Using the “Custom CSS” Field in the Theme Customizer

For Dawn and many other modern themes, you can add custom CSS directly to a section, which is a great way to keep your code organized and specific. @tim_tairli's suggestion is perfect for this.

  1. Go to your Shopify Admin: Online Store > Themes > Customize.
  2. Navigate to a Product Page.
  3. In the left sidebar, click on the Product information section.
  4. Scroll down to the bottom of the section settings and look for a field labeled “Custom CSS” or “Custom Liquid.”
  5. Paste the following code:
@media screen and (min-width: 750px) {
  /* make all images same width, 1 per row */
  .product__media-list .product__media-item {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* make media gallery stick at the header bottom */
  media-gallery.product__column-sticky {
    top: var(--header-height, 3rem);
  }
  /* Hide slider controls if they still appear */
  .slider-buttons, .slider-counter, .product__media-icon {
    display: none !important;
  }
}

This snippet specifically targets the media items to ensure they take up full width (one per row) and makes the media gallery sticky, aligning it with your header height for a seamless look.

General Best Practices & Warnings

  • Always Backup: We cannot stress this enough. Duplicate your theme before any code changes.
  • Test Thoroughly: After implementing any code, check your product pages on various desktop browsers and screen sizes. Ensure responsiveness on mobile is not negatively affected (the provided code snippets are generally scoped to `min-width: 750px` or `990px` to maintain mobile slider functionality).
  • Identify Your Theme: As mentioned, “Canyon” is often a renamed Dawn. Knowing your base theme helps in understanding its structure and potential built-in features.
  • Future Theme Updates: Custom code can sometimes conflict with future theme updates. If you update your theme, be prepared to re-apply or adjust your customizations.
  • Consider Professional Help: If you're uncomfortable with code or encounter unexpected issues, don't hesitate to reach out to a Shopify expert. At Shopping Cart Mover, we specialize in Shopify migrations and customizations, ensuring your store looks and functions exactly as you envision.

Conclusion

Implementing a stacked and sticky product image gallery on your Shopify store can significantly enhance the visual appeal and user experience, leading to better engagement and potentially higher conversion rates. While modern themes offer some built-in flexibility, custom code provides the ultimate control. By following these steps, you can transform your product pages and give your customers a more immersive and intuitive way to explore your offerings.

Share:

Use cases

Explore use cases

Agencies, store owners, enterprise — find the migration path that fits.

Explore use cases