Webflow sync, pageviews & more.
NEW

How can I make the pagination in Swiper.js work in my Webflow project? I have tried both the progress bar pagination and the bullet style pagination, but neither of them is functioning. Can someone please help me identify where I went wrong?

TL;DR
  • Add Swiper CSS and JS via CDN in Webflow’s Page Settings or Embed element.
  • Structure your HTML using correct Swiper class names (swiper, swiper-wrapper, swiper-slide, and swiper-pagination).
  • Initialize Swiper in Footer Code with matching selectors and pagination configuration (e.g., bullets or progressbar).
  • Verify class name consistency, include Swiper CSS, avoid Webflow slider conflicts, and use Embed elements for precision.

To make Swiper.js pagination work in Webflow, ensure you’ve properly initialized the Swiper instance with matching selectors and correct configuration. If pagination styles like progress bar or bullets aren't working, it's likely due to one of several common issues. Here's how to troubleshoot and fix it.

1. Include Swiper.js and CSS in Your Webflow Project

  • Swiper Core JS and CSS must be added to the Page Settings → Custom Code section or embedded in an Embed element.
  • Include both the Swiper CSS file (for styles like bullets and progress bar) and Swiper JS file (for functionality).
  • Use CDN links from the Swiper docs (https://swiperjs.com/get-started).

2. Structure Your HTML Elements in Webflow Properly

  • Make sure your structure follows Swiper's required format:
  • A wrapper element with the class swiper,
  • A container with the class swiper-wrapper,
  • Multiple slides inside, each with the class swiper-slide.

Example:

<div class="swiper">  <div class="swiper-wrapper">    <div class="swiper-slide">Slide 1</div>    <div class="swiper-slide">Slide 2</div>  </div>  <div class="swiper-pagination"></div></div>
  • Use Webflow custom classes (e.g., swiper, swiper-wrapper, etc.) that exactly match the names you’ll reference in the JS.
  • Go to Page Settings → Footer Custom Code and paste the initialization script within script tags.
  • Use the same class names from your Webflow elements.

Example for bullet pagination:

var swiper = new Swiper('.swiper', {  loop: false,  pagination: {    el: '.swiper-pagination',    clickable: true,  },});

Example for progressbar pagination:

var swiper = new Swiper('.swiper', {  loop: false,  pagination: {    el: '.swiper-pagination',    type: 'progressbar',  },});

4. Common Issues to Check

  • Selector mismatch: Double-check that the class names in your HTML match the ones used in your Swiper instance.
  • Missing Swiper CSS: Without it, the pagination elements (e.g., bullets) won't be visible or styled.
  • Multiple Swiper instances: If using multiple sliders, assign unique selector classes to each Swiper instance and its pagination element.
  • Webflow's conflicting interactions: Disable Webflow slider components or animations that may interfere with Swiper initialization.

5. Webflow-Specific Tips

  • Use Webflow Embed components to directly add the swiper-pagination container if Webflow’s UI doesn’t provide precise HTML structure.
  • Set Slides and the Wrapper to 100% width/height using Webflow’s layout controls to avoid layout or overflow issues.

Summary

To fix your Swiper pagination in Webflow, ensure all HTML classes follow Swiper’s required format, that you’ve included the correct CSS and JS, and that the Swiper instance configuration matches your layout. Pagination won't work without the correct structure, style references, and script setup.

Rate this answer

Other Webflow Questions