Infinite Logo Slider: Splide Auto Scroll or Pure CSS

This tutorial shows two ways to build a seamless, endless logo slider: with the Splide JavaScript library and its Auto Scroll extension, and with pure CSS and no JavaScript at all. Both work well for client or partner logos.

I start with Splide, which adds drag and swipe, and then show the CSS version. If all you need is a plain strip of logos, the CSS version is lighter, and I explain why further down.

The slider below runs on the exact Splide code from this post:

BigPanda
CultureTrip
SimilarWeb
Monday
Logz.io
Forter
Crazy Labs
Bookaway
Startapp
daytwo.com
Cnvrg.io
cisoteria.com
webz.io
cashflowfrog.com
yotpo.com

What You Need

  • A modern web browser.
  • Basic knowledge of HTML, CSS, and JavaScript.
  • Splide 4.1.4 and the Auto Scroll extension 0.5.3. You can download them from Splide or load them from a CDN.

Neither package has had a new release since 2022 (checked October 2026). They still work, and the demo above runs on these exact versions.

Posts have already been written in the past explaining how to create cool sliders. One using Slick Slider and the other using Vegas Slider. Take a look if you’re interested.

Step 1: Include Splide in Your Project

First, add the Splide CSS and JavaScript files to your project. It is important to load the auto-scroll extension after the main Splide library to ensure it initializes correctly. You can link them directly from a CDN, or if you are using WordPress, you can enqueue them in your theme.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@splidejs/[email protected]/dist/css/splide-core.min.css">
<script src="https://cdn.jsdelivr.net/npm/@splidejs/[email protected]/dist/js/splide.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/@splidejs/[email protected]/dist/js/splide-extension-auto-scroll.min.js" defer></script>

A logo strip has no arrows or dots, so the small splide-core.min.css (under 1 KB gzipped) is enough. The full splide.min.css only adds the default theme for those controls. The defer attribute keeps the scripts from blocking the page while it renders, and they still run in order.

If you’re integrating Splide into a WordPress site, add the following to your theme’s functions.php file to properly enqueue the scripts and styles:

function enqueue_splide_assets() {
    // Load Splide only where the slider is used.
    if ( ! is_front_page() ) {
        return;
    }

    $cdn  = 'https://cdn.jsdelivr.net/npm/@splidejs';
    $args = array( 'strategy' => 'defer', 'in_footer' => true );

    wp_enqueue_style( 'splide', $cdn . '/[email protected]/dist/css/splide-core.min.css', array(), '4.1.4' );
    wp_enqueue_script( 'splide', $cdn . '/[email protected]/dist/js/splide.min.js', array(), '4.1.4', $args );
    wp_enqueue_script( 'splide-auto-scroll', $cdn . '/[email protected]/dist/js/splide-extension-auto-scroll.min.js', array( 'splide' ), '0.5.3', $args );
}
add_action( 'wp_enqueue_scripts', 'enqueue_splide_assets' );

Three things in this snippet matter for performance:

  • The condition. Replace is_front_page() with whatever matches the pages that show the slider, so the rest of the site doesn’t download Splide at all.
  • The strategy argument. It adds defer to both scripts (WordPress 6.3 and later). Read more about deferring JavaScript.
  • Pinned versions. The URLs include exact versions, so the files never change under you.

Want to skip the extra connection to a third-party CDN? Download the two JS files and the CSS file into your theme and point the URLs at get_template_directory_uri().

The package names need the @splidejs/ scope. An older version of this snippet used npm/splide@4, which returns a 404 on jsDelivr. If your slider stopped working after copying it, that is why.

Step 2: Add HTML Structure

Create the HTML structure for your slider. Here’s a basic setup:

<div class="splide logo-slider">
  <div class="splide__track">
    <ul class="splide__list">
      <li class="splide__slide"><img src="logo1.png" alt="Logo 1" width="130" height="80"></li>
      <li class="splide__slide"><img src="logo2.png" alt="Logo 2" width="130" height="80"></li>
      <!-- Add more logos as needed -->
    </ul>
  </div>
</div>

Give every logo a width and height. The browser then reserves the space before the images arrive, so nothing jumps while the page loads.

Step 3: Initialize Splide

Use the following JavaScript to start the slider. Change .logo-slider to the class on your slider:

document.addEventListener('DOMContentLoaded', function () {
    const el = document.querySelector('.logo-slider');
    if (!el) return;

    const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
    const canObserve = 'IntersectionObserver' in window;

    const splide = new Splide(el, {
        type: 'loop',
        direction: document.documentElement.dir === 'rtl' ? 'rtl' : 'ltr',
        drag: 'free',
        focus: 'center',
        arrows: false,
        pagination: false,
        perPage: 3,
        gap: '2rem',
        autoScroll: reduceMotion ? false : {
            speed: 0.5,
            pauseOnHover: true,
            pauseOnFocus: true,
            autoStart: !canObserve,
        },
        mediaQuery: 'min',
        breakpoints: {
            600: { perPage: 4 },
            1024: { perPage: 6 },
        },
    });

    splide.mount(window.splide.Extensions);

    // Run the scroll only while the slider is on screen.
    if (!reduceMotion && canObserve) {
        const autoScroll = splide.Components.AutoScroll;
        new IntersectionObserver(function (entries) {
            entries[0].isIntersecting ? autoScroll.play() : autoScroll.pause(false);
        }).observe(el);
    }
});

What each part does:

  • type: 'loop' clones the slides at both ends, so the strip never runs out.
  • direction follows the page direction from the html tag. On a Hebrew or Arabic site it becomes 'rtl', and without it the slider will likely not show at all.
  • drag: 'free' lets visitors drag or swipe the strip, and auto scroll picks up again when they let go.
  • mediaQuery: 'min' makes the breakpoints work mobile-first: 3 logos on small screens, 4 from 600px and 6 from 1024px.
  • speed is the number of pixels the strip moves on every animation frame. On a 120Hz screen it moves twice as fast as on a 60Hz one.
  • window.splide.Extensions is where the CDN build of Auto Scroll registers itself. Without it, the slider loads but never moves.

Reduced Motion and Off-Screen Pausing

The Auto Scroll extension ignores the prefers-reduced-motion setting. I checked the source of version 0.5.3: it has no such check, and Splide’s own reducedMotion option only covers regular transitions and autoplay. So the code checks the setting itself and sets autoScroll: false for visitors who asked for less motion. They get a static row of logos they can still drag.

Auto Scroll also keeps moving the strip on every frame while it is off screen. The IntersectionObserver starts it when the slider enters the viewport and pauses it when it leaves. That is also why autoStart is off when the observer is available: otherwise the extension starts the strip on page load, even below the fold.

No need to hide the slider with opacity: 0 until it is ready. Splide’s core CSS already keeps .splide hidden until it is initialized.

Using WordPress?

If you’re integrating Splide into a WordPress site, it’s good practice to place your initialization script in a separate JavaScript file and enqueue it similarly to how you included the library. This ensures your scripts load in the correct order.

Add this to your theme’s functions.php:

function enqueue_splide_init_script() {
    if ( ! is_front_page() ) {
        return;
    }

    wp_enqueue_script(
        'splide-init',
        get_template_directory_uri() . '/js/splide-init.js',
        array( 'splide-auto-scroll' ),
        '1.0',
        array( 'strategy' => 'defer', 'in_footer' => true )
    );
}
add_action( 'wp_enqueue_scripts', 'enqueue_splide_init_script' );

Put the Step 3 JavaScript in splide-init.js. The dependency on splide-auto-scroll (which itself depends on splide) makes WordPress print the three scripts in the right order. Deferred scripts run before DOMContentLoaded fires, so the listener in Step 3 still works.

Pure CSS Infinite Logo Slider (No JavaScript)

If the logos only need to scroll by, you can skip Splide entirely. This version is HTML and CSS only, and it is running live below:

  • BigPanda
  • CultureTrip
  • SimilarWeb
  • Monday
  • Logz.io
  • Forter
  • Crazy Labs
  • Bookaway
  • Startapp
  • daytwo.com
  • Cnvrg.io
  • cisoteria.com
  • webz.io
  • cashflowfrog.com
  • yotpo.com

The trick is to put the list of logos on the page twice, side by side, and slide the whole row left by exactly half its width. At that point the second copy sits where the first one started, and the animation restarts without a visible jump.

<div class="logo-marquee">
  <div class="logo-marquee__track">
    <ul class="logo-marquee__group">
      <li><img src="logo1.png" alt="Logo 1" width="130" height="80"></li>
      <li><img src="logo2.png" alt="Logo 2" width="130" height="80"></li>
      <!-- Add more logos as needed -->
    </ul>
    <!-- An exact copy of the list above -->
    <ul class="logo-marquee__group" aria-hidden="true">
      <li><img src="logo1.png" alt="" width="130" height="80"></li>
      <li><img src="logo2.png" alt="" width="130" height="80"></li>
    </ul>
  </div>
</div>
.logo-marquee {
  overflow: hidden;
  direction: ltr; /* keeps the math the same on RTL sites */
  mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
}

.logo-marquee__track {
  display: flex;
  width: max-content;
  animation: logo-marquee 50s linear infinite;
}

.logo-marquee__group {
  display: flex;
  align-items: center;
  gap: 3rem;
  padding-inline-end: 3rem; /* same as the gap, so the seam matches */
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.logo-marquee__group > li {
  flex: none;
}

.logo-marquee:hover .logo-marquee__track,
.logo-marquee:focus-within .logo-marquee__track {
  animation-play-state: paused;
}

@keyframes logo-marquee {
  to {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .logo-marquee {
    overflow-x: auto;
    mask-image: none;
  }

  .logo-marquee__track {
    animation: none;
  }

  .logo-marquee__group[aria-hidden="true"] {
    display: none;
  }
}

How it works:

  • width: max-content makes the track exactly as wide as the two lists together, so translateX(-50%) moves it by one full list.
  • padding-inline-end on each list matches the gap. Without it, the space between the last logo and the copy is missing, and you see a small jump on every loop.
  • aria-hidden="true" and empty alt text on the copy stop screen readers from announcing every logo twice.
  • The mask-image gradient fades both edges. Read more about CSS mask-image.
  • For reduced motion, the animation stops, the copy is hidden and visitors can swipe or scroll the row sideways instead.
  • Change the speed with the animation duration. It is time-based, so the strip moves at the same speed on a 60Hz and a 120Hz screen.

Each list must be at least as wide as the container. With only three or four logos, a gap opens before the copy arrives. Repeat the logos inside each list until it is wider than the widest screen you care about.

The animation only changes transform, so the browser can run it on the compositor without layout or paint work on each frame. More on that in animation and scrolling performance.

Splide or Pure CSS?

Both sliders on this page look almost the same. Here is how they differ:

Pure CSS Splide + Auto Scroll
JavaScript to download None About 15 KB gzipped
Drag and swipe No Yes
Speed Time-based, same on every screen Pixels per frame, faster on 120Hz screens
Reduced motion One media query Your own check in JavaScript
Pause on hover animation-play-state Built in (pauseOnHover)

Pick CSS for a plain logo strip. Pick Splide if the site already loads it for other carousels, or if visitors should be able to drag the logos.

More Configuration Options

For a complete list of all configuration options available in Splide, visit the Splide Documentation – Options page. This resource is invaluable for customizing the slider to fit the specific needs and responsiveness of your website.

FAQs

Common questions about infinite logo sliders with Splide and CSS:

How do I make a Splide slider loop infinitely?
Set type: 'loop' in the options. Splide clones slides at both ends so the slider never reaches an edge. To keep it moving on its own, add the Auto Scroll extension and mount it with splide.mount(window.splide.Extensions).
Why is my Splide auto scroll not moving?
Check four things: the extension script loads after Splide, you pass window.splide.Extensions to mount(), autoScroll is not set to false, and the slider type is not 'fade'. Auto Scroll doesn't run on fade sliders.
How do I pause the Splide auto scroll on hover?
pauseOnHover is true by default, so it pauses unless you turned it off. You can also control it from code with splide.Components.AutoScroll.pause() and splide.Components.AutoScroll.play().
Can I build an infinite logo slider with only HTML and CSS?
Yes. Put the list of logos on the page twice inside a width: max-content flex row, and animate the row from translateX(0) to translateX(-50%) with linear infinite. The full code is in the pure CSS section above.
Why does my CSS logo slider jump at the end of each loop?
Usually the two lists are not the same width. Make the copy an exact duplicate, and add padding-inline-end equal to the gap on each list so the space between them matches. If the lists are narrower than the container, add more logos.
Does Splide auto scroll respect prefers-reduced-motion?
No. Version 0.5.3 of the extension has no reduced motion check, and Splide's reducedMotion option doesn't cover it. Check matchMedia('(prefers-reduced-motion: reduce)') yourself and set autoScroll: false when it matches.
How do I add Splide to WordPress?
Enqueue the CSS and both scripts from functions.php with wp_enqueue_style() and wp_enqueue_script(), using the @splidejs/ package URLs and 'strategy' => 'defer'. Wrap the calls in a condition so Splide only loads on pages that show the slider.

Conclusion

You now have two ways to run an endless logo strip. Splide with Auto Scroll gives you drag, swipe and fine control. The CSS version needs no JavaScript and moves at the same speed on every screen.

Whichever you pick, keep the two habits from this post: respect reduced motion, and load the slider’s assets only on the pages that use it.

Discussion
[  0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!