Swiper function not working on custom liquid section,

Topic summary

A user is attempting to implement Swiper functionality for an ingredient images section using Shopify’s custom liquid section. The goal is to create a carousel for mobile screens while maintaining a horizontal row layout on desktop.

Current Issue:

  • Swiper is not functioning despite including the Swiper CSS library and implementing media queries
  • User questions whether using custom liquid (vs. editing code directly) is causing the problem

Code Structure:

  • Includes Swiper CSS from unpkg CDN
  • Uses media queries to toggle between desktop flex layout and mobile swiper
  • Contains swiper-container, swiper-wrapper, and swiper-slide elements
  • Note: The HTML content in the post appears corrupted/reversed, making full code review difficult

Proposed Solution:
A responder (PageFly-Richard) suggests:

  • Moving the Swiper library link to the top of the file to ensure proper loading order
  • Changing the link type (suggestion appears cut off)

The discussion remains open with the user awaiting confirmation if the suggested fix resolves the issue. No JavaScript initialization code for Swiper is visible in the provided snippet, which may be a contributing factor.

Summarized with AI on November 12. AI used: claude-sonnet-4-5-20250929.

Hi,

I am trying to add a simple swiper function to the ingredient images section, and tried to get everything done in custom liquid on the admin page. I tried many different styles to see if that works, but none of them has worked. Is that because I am using the custom liquid section rather than creating an actual section by"edit code"?

What I am trying to create is adding the swiper function for the image when the page is opened by phone screen and keep the images line up on the same row when opened on desktop screen.

It would be great if I can do that by what I am currently doing since I am new to coding and don’t have much knowledge. I would greatly appreciated if anyone could identify the error or explain me the way to solve this!

Here is the entire code of the section:

{{ ‘//unpkg.com/swiper/swiper-bundle.min.css’ | stylesheet_tag }}

.ingredients-statement { text-align: center; } .key-ingredients-container { display: flex; } .ingredients { box-sizing: border-box; padding: 10px; } .ingredient-img { width: 100%; height: auto; } .ingredient-detail { text-align: center; } h1, h2 { font-family: 'aperto', sans-serif; .star-ingredients { font-size: 60px; } h2 { font-size: 40px; } .swiper-container { display: none; } @media screen and (max-width: 640px) { .key-ingredients-container { display: none; } .swiper-container { display: block; } .swiper-slide { text-align: center; } .ingredient-img { max-width: 100%; height: auto; } .ingredient-detail { margin: 10px 0; } }

BAKUCHIOL

Firms, strengthens, and improves the appearance of fine lines and wrinkles​

BAKUCHIOL

Firms, strengthens, and improves the appearance of fine lines and wrinkles​

BAKUCHIOL

Firms, strengthens, and improves the appearance of fine lines and wrinkles​

BAKUCHIOL

Firms, strengthens, and improves the appearance of fine lines and wrinkles​

BAKUCHIOL

Firms, strengthens, and improves the appearance of fine lines and wrinkles​

BAKUCHIOL

Firms, strengthens, and improves the appearance of fine lines and wrinkles​

BAKUCHIOL

Firms, strengthens, and improves the appearance of fine lines and wrinkles​

BAKUCHIOL

Firms, strengthens, and improves the appearance of fine lines and wrinkles​

{{ ‘//unpkg.com/swiper/swiper-bundle.min.js’ | script_tag }}

Hi @Mercado9778

This is Richard from PageFly - Shopify Page Builder App

You can try putting the link of swiper on top of your file to make sure everything loads properly, or you can change the type of embedded link

To be like this

PageFlyRichard_0-1708488152699.png

Hope this can help you solve the issue

Best regards,

Richard | PageFly