Fixing Product Media Glitches on Shopify: A Community Deep Dive for Store Owners

Hey everyone! I was just browsing through the Shopify community forums, and I stumbled upon a really insightful discussion that I knew I had to share with you. It touched on some frustrating product media issues that many store owners face, especially when they've customized their themes. Our friend, Tilda_Falth, reached out for help with her 'edited Horizon theme,' and the community, particularly 'tim_1,' came through with some fantastic solutions. Let's break down what happened and how you can apply these fixes to your own store.

The Root of Tilda's Product Page Pains

Tilda was experiencing a few major headaches on her product pages. Her media gallery wasn't quite right:

  • Clickability Issues: Thumbnails and chevrons on the main image weren't working. She could click the main image to enlarge it, and then the thumbnails would become clickable within that larger view. Swiping on mobile still worked, thankfully.
  • Mobile Thumbnail Placement: She wanted her product image thumbnails to appear to the left on desktop but at the bottom on mobile. Her current setup, however, was making the mobile position change depending on her desktop settings, which wasn't ideal.

She also mentioned problems with her "Recommended products" block, where product media wasn't showing correctly, chevrons were unclickable, and images only appeared on hover. Plus, she wanted to tweak the swipe behavior and remove some hover chevrons. While the community focused on the critical gallery issues, it's a good reminder that theme customizations can sometimes have cascading effects!

Unraveling the JavaScript Mystery: The Slideshow.js Fix

The first big breakthrough came when tim_1 pointed out some JavaScript errors on Tilda's site. It turns out a custom code snippet, a private method called #updateContainerHeight(), was causing the main slideshow functionality to break. The problem? It was declared at the very bottom of the Slideshow class definition in assets/slideshow.js but was being referenced much earlier in the file.

This is a classic JavaScript gotcha: you can't use something before it's defined! Luckily, the fix was straightforward: move that code block to a higher position within the class.

Step-by-Step: Correcting Your slideshow.js

Before you start, always duplicate your theme as a backup! This is non-negotiable when editing theme code.

  1. In your Shopify admin, go to Online Store > Themes.
  2. Find your current theme, click Actions > Duplicate.
  3. Once duplicated, click Actions > Edit code on your working theme.
  4. Navigate to the assets folder and open slideshow.js.
  5. Search for the #updateContainerHeight() method. It likely looks like this:

    
    /**
     * Updates the container height based on the current slide's aspect ratio
     */
      #updateContainerHeight() {
        const { slides, scroller } = this;
        if (!slides || !scroller) return;
    
        const currentSlide = slides[this.current];
        if (!currentSlide) return;
    
        const img = currentSlide.querySelector('img, video, model-viewer');
        if (!img) return;
    
        if (img.tagName === 'IMG' && !img.complete) {
          img.addEventListener('load', () => this.#updateContainerHeight(), { once: true });
          return;
        }
    
        if (img.tagName === 'IMG') {
          const naturalWidth = img.naturalWidth;
          const naturalHeight = img.naturalHeight;
    
          if (naturalWidth && naturalHeight) {
            const c
            const aspectRatio = naturalHeight / naturalWidth;
            const calculatedHeight = containerWidth * aspectRatio;
    
            scroller.style.height = `${calculatedHeight}px`;
            scroller.style.transition = 'height 0.4s ease';
          }
        }
      }
    
  6. Cut this entire code block.

  7. Now, search for requiredRefs = ['scroller'];. This line is typically around line 77 in many themes. You'll want to paste the #updateContainerHeight() method right below it, similar to this visual:

    Screenshot 2026-03-18 at 11.11.10 PM

  8. Paste the #updateContainerHeight() method there.
  9. Save the file.

Tilda confirmed this JavaScript adjustment immediately restored her slider functionality, making thumbnails and chevrons clickable again! Sometimes, it's all about correct placement.

Mastering Responsive Design: Thumbnails on Desktop & Mobile

Next up was Tilda's desire for different thumbnail layouts based on device: left-aligned on desktop, bottom-aligned on mobile. As tim_1 noted, Shopify themes often default to bottom thumbnails on mobile, so custom CSS was likely overriding this. The solution involved wrapping the desktop-specific thumbnail styling in a media query.

Step-by-Step: Adjusting Thumbnail Position with CSS

Again, ensure you've duplicated your theme before making CSS changes!

  1. In your Shopify admin, go to Online Store > Themes.
  2. Click Actions > Edit code.
  3. Navigate to the assets folder and open base.css (or your theme's main CSS file, if different).
  4. Search for slideshow-component:has(slideshow-controls[thumbnails]). You should find a single match. Add the following CSS right above it:

    @media (min-width:750px){
    

    Screenshot 2026-03-19 at 11.03.50 PM

  5. Next, search for .slideshow-controls__arrows. This should also be a single occurrence. Add a closing curly brace } right above this line, like so:

    Screenshot 2026-03-19 at 11.07.26 PM

  6. Save the file.

This simple CSS change, using a media query, ensures that the thumbnail layout applies only when the screen width is 750px or greater (typical for desktop), allowing the theme's default mobile layout to kick in below that breakpoint. Tilda confirmed this fix worked perfectly for her!

What About the Other Questions?

It's worth noting that Tilda had a couple of other questions that weren't directly addressed in this specific thread. She asked about connecting product variants to images so the main image switches when a variant is selected, and about the issues with the "Recommended products" block. These are common customization requests, and often require more in-depth theme development or specific apps. For variant image switching, many modern Shopify themes (like Dawn and its derivatives) have this functionality built-in, but if yours doesn't, it might require custom JavaScript or a dedicated app to achieve a seamless experience.

This discussion really highlights a few key takeaways for all of us Shopify store owners:

  • Backup, Backup, Backup: Seriously, before you touch any code, duplicate your theme. It's your safety net!
  • Understanding Custom Code: Be mindful of any custom code added to your theme, especially if you're using tools like Sidekick or hiring developers. Knowing where and how things are implemented can save you a lot of troubleshooting time.
  • The Power of the Community: Don't hesitate to reach out to the Shopify Community forums! There are incredibly knowledgeable folks like tim_1 who are willing to lend a hand and share expertise.

Hopefully, these insights from Tilda's experience and tim_1's solutions help you keep your product pages running smoothly. Happy selling!

Share:

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools