Skip to content

Squarespace Carousel Autoplay: Free Script for List, Summary and Gallery Carousels

By Sukesh Das 13 min read

Squarespace carousel autoplay and gallery auto scroll code
On this page

Squarespace carousel autoplay is only built in for a few layouts, mainly gallery slideshows and the scrolling block. List section carousels, summary block carousels and gallery reels have no autoplay switch, so you need a small script in Code Injection that clicks the next arrow on a timer. Below is my free script with one settings object, plus CSS for mobile gallery columns, lightbox captions and arrow styling.

I’m Sukesh Das, a Squarespace Circle Platinum Partner. I have built more than 1,200 websites since 2018, and while researching this guide I reviewed over 7,000 solved questions on the Squarespace Forum. Questions about making a carousel move on its own come up constantly, and most of the answers are one-off scripts that only handle one carousel type.

Squarespace carousel autoplay options at a glance

Here is what each carousel type can do out of the box, and what you need to add yourself.

Carousel typeBuilt-in autoplayWhere the fix goes
Gallery section, slideshow layoutsCheck the section design panel firstCustom script only if no option shows
Gallery section, reel layoutNo built-in autoplayFooter Code Injection
List section, carousel layoutNo built-in autoplayFooter Code Injection
Summary block, carousel layoutNo built-in autoplayFooter Code Injection
Scrolling text (marquee) blockBuilt in, with speed and directionBlock settings
Logo strip that scrolls foreverNot built in for imagesCode Block plus Custom CSS
Gallery grid columns on mobileLimitedCustom CSS
Captions inside the lightboxNot shown by defaultFooter Code Injection plus CSS

Before you start

  • Custom CSS works on every plan. You find it at Website → Pages → Custom Code → Custom CSS. Everything here that is pure CSS (arrows, mobile columns, the marquee animation) works on any plan.
  • Code Injection needs a Core, Plus or Advanced plan, or one of the older Business or Commerce plans. The autoplay script and the lightbox caption script both need it. Squarespace explains the details in its Code Injection guide.
  • Save a copy of your current code in a text file before you paste anything new.
  • Check the result on the live site in a private window. Scripts do not run inside the editor the same way, and my autoplay script switches itself off in edit mode on purpose.

Does Squarespace have built-in carousel autoplay?

Partly. Before you add any code, always check the design panel of the section or block. Squarespace adds options over time, and a built-in setting will always be more stable than a script.

Here is where I look first:

  • Gallery section slideshows. Edit the section, open the design options and look for an autoplay toggle. Depending on the slideshow layout you pick, you may see autoplay and a timing option. If it is there, use it and skip the script for that section.
  • The older Gallery Block. If your site still uses a Gallery Block in slideshow mode, its design settings include autoplay with a speed control.
  • The scrolling block. For moving text, Squarespace has a scrolling (marquee) block in Fluid Engine with its own speed and direction settings. It handles text only, not logos.
  • List section carousels, summary block carousels and gallery reels. As far as I know there is no autoplay switch for these. Visitors have to click the arrows.

That last group is where almost every forum question about Squarespace carousel autoplay comes from. People build a nice testimonial carousel with a list section, or a blog carousel with a summary block, and then find out it will not move by itself. That is what the script below fixes.

How do I add Squarespace carousel autoplay to list and summary carousels?

The idea is simple. Every one of these carousels already has a next arrow. My script finds each carousel on the page and clicks its next arrow every few seconds. Because it uses the arrow Squarespace already built, the slide animation, looping and spacing all stay exactly as Squarespace designed them.

I checked every selector in this script against accepted answers on the Squarespace Forum, so it targets the class names Squarespace really uses on 7.1 sites:

  • .user-items-list-carousel and .user-items-list-carousel__arrow-button--right for list section carousels.
  • .summary-carousel and .summary-carousel-pager-next for summary block carousels.
  • .gallery-reel and .gallery-reel-control-btn[data-next] for gallery reel sections.

Paste this into Website → Pages → Custom Code → Code Injection → Footer. You only need to change the SETTINGS object at the top.

<!-- Carousel autoplay for Squarespace 7.1 by Sukesh Das, sukeshdas.com -->
<script>
(function () {
  var SETTINGS = {
    speed: 4000,            // milliseconds between slides
    pauseOnHover: true,     // stop while the mouse or a finger is on the carousel
    listCarousels: true,    // list section carousels
    summaryCarousels: true, // summary block carousels
    galleryReels: true,     // gallery reel sections
    onlySections: []        // leave empty for all, or add section IDs: ['abc123']
  };

  var TARGETS = [
    { on: 'listCarousels', box: '.user-items-list-carousel', next: '.user-items-list-carousel__arrow-button--right' },
    { on: 'summaryCarousels', box: '.summary-carousel', next: '.summary-carousel-pager-next' },
    { on: 'galleryReels', box: '.gallery-reel', next: '.gallery-reel-control-btn[data-next]' }
  ];

  class SukeshDasCarouselAutoplay {
    constructor(box, nextSelector) {
      this.box = box;
      this.nextSelector = nextSelector;
      this.paused = false;
      this.timer = null;
      box.dataset.sdAutoplay = 'on';
      if (SETTINGS.pauseOnHover) {
        var self = this;
        ['mouseenter', 'touchstart', 'focusin'].forEach(function (ev) {
          box.addEventListener(ev, function () { self.paused = true; }, { passive: true });
        });
        ['mouseleave', 'touchend', 'focusout'].forEach(function (ev) {
          box.addEventListener(ev, function () { self.paused = false; }, { passive: true });
        });
      }
      this.start();
    }

    findNext() {
      var section = this.box.closest('section') || document;
      return this.box.querySelector(this.nextSelector) || section.querySelector(this.nextSelector);
    }

    tick() {
      if (this.paused || document.hidden || !document.body.contains(this.box)) return;
      var next = this.findNext();
      if (next) next.click();
    }

    start() {
      var self = this;
      this.timer = window.setInterval(function () { self.tick(); }, SETTINGS.speed);
    }

    static allowed(box) {
      if (!SETTINGS.onlySections.length) return true;
      var section = box.closest('section[data-section-id]');
      return !!section && SETTINGS.onlySections.indexOf(section.getAttribute('data-section-id')) !== -1;
    }

    static init() {
      if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
      if (document.body.classList.contains('sqs-edit-mode')) return;
      TARGETS.forEach(function (t) {
        if (!SETTINGS[t.on]) return;
        document.querySelectorAll(t.box).forEach(function (box) {
          if (box.dataset.sdAutoplay || !SukeshDasCarouselAutoplay.allowed(box)) return;
          new SukeshDasCarouselAutoplay(box, t.next);
        });
      });
    }
  }

  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', SukeshDasCarouselAutoplay.init);
  } else {
    SukeshDasCarouselAutoplay.init();
  }
  window.addEventListener('mercury:load', SukeshDasCarouselAutoplay.init);
})();
</script>

Written for Squarespace 7.1. A few notes on what it does, because the details matter more than the length of the code.

  • speed is the time between slides in milliseconds. 4000 means four seconds. For testimonials with long quotes I usually go to 6000 or 7000 so people can finish reading.
  • pauseOnHover stops the carousel while the mouse is over it, while a finger is touching it, or while a keyboard user has focus inside it. I strongly recommend leaving this on.
  • listCarousels, summaryCarousels, galleryReels let you switch each carousel type on or off. Set one to false and that type stays manual.
  • onlySections limits autoplay to certain sections. Leave it empty to run everywhere, or add section IDs like ['64f0c2a1b2c3', '64f0c2a1d4e5'].

The script also skips any visitor who has asked their device to reduce motion, waits when the browser tab is hidden, and runs again on mercury:load, which Squarespace fires when a page loads by AJAX. Without that last part, autoplay would only work after a refresh. I explain that issue in my guide on why Squarespace code stopped working.

To find a section ID for onlySections, right-click the section on your live site, choose Inspect, and copy the value of data-section-id from the section tag.

Why is my Squarespace carousel autoplay not working?

When people tell me their Squarespace carousel autoplay does nothing, it is almost always one of these:

  • The code is in Custom CSS. Scripts go in Code Injection, not the CSS editor. The CSS editor will not run JavaScript.
  • The plan does not include Code Injection. On Basic or the legacy Personal plan, the script is saved but never runs.
  • You are checking inside the editor. Open the live site in a private window instead.
  • Reduced motion is switched on on your own phone or computer. The script respects it, so it will look broken to you while working for everyone else.
  • The carousel shows all items at once. If there are only three cards and three fit on screen, there is no next slide, so nothing moves. Add more items or show fewer per row.
  • A jQuery snippet from an old answer is fighting it. Remove older autoplay scripts before you add a new one. Two timers clicking the same arrow make the carousel skip slides.

What about a scrolling logo strip?

A row of client logos that scrolls forever is not really a carousel, and the built-in scrolling block only handles text. I wrote a separate guide for it: my Squarespace logo slider post has one Code Block with an endless loop, grayscale to color hover, pause on hover and reduced motion support built in.

How do I pause a carousel on hover?

Pause on hover matters more than people think. If a visitor is reading a testimonial and it slides away, that is annoying, and they leave the carousel alone after that.

In my autoplay script it is one setting: pauseOnHover: true. It also covers touch, which hover alone does not, and keyboard focus, so the carousel stops if someone tabs to a link inside a slide.

How do I respect prefers-reduced-motion?

Some people get dizzy or distracted by moving content, and they turn on a reduce motion setting on their phone or computer. Browsers expose that as the prefers-reduced-motion media feature.

I treat this as a must, not a nice extra, for any Squarespace carousel autoplay setup. My script checks it before it starts and does nothing if motion should be reduced. The carousels still work normally with the arrows, so nobody loses content.

If you already have other animations on your site, this small rule calms them down for those visitors as well:

/* Reduced motion safety net by Sukesh Das, sukeshdas.com */
@media (prefers-reduced-motion: reduce) {
  .user-items-list-carousel__slides,
  .summary-carousel,
  .gallery-reel {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

This is not autoplay, but it comes up in the same threads. People set a gallery grid to four columns on desktop and then dislike how Squarespace stacks it on phones. The grid is drawn with CSS grid on .gallery-grid-wrapper, so you can set the columns yourself:

/* Gallery grid columns on mobile by Sukesh Das, sukeshdas.com */
@media screen and (max-width: 767px) {
  .gallery-grid-wrapper {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
}

Change the 2 to 1 for a single column or 3 for a tighter grid. To change one gallery only, put section[data-section-id="PASTE-SECTION-ID"] in front of the selector. I cover more phone layout fixes in how to fix Squarespace mobile issues.

Gallery sections can show captions under images, but when a visitor opens the lightbox the caption is gone. For portfolios and product galleries that is a real loss. First switch on captions in the gallery section settings and add text to each image. Then add this script to the footer Code Injection, below the autoplay script if you use both:

<!-- Lightbox captions for gallery sections by Sukesh Das, sukeshdas.com -->
<script>
(function () {
  function sukeshDasLightboxCaptions() {
    document.querySelectorAll('section.page-section').forEach(function (section) {
      var captions = section.querySelectorAll('.gallery-caption-content');
      var slides = section.querySelectorAll('.gallery-lightbox-list .gallery-lightbox-item');
      slides.forEach(function (slide, i) {
        if (!captions[i] || slide.querySelector('.sd-lightbox-caption')) return;
        var p = document.createElement('p');
        p.className = 'sd-lightbox-caption';
        p.textContent = captions[i].textContent.trim();
        slide.appendChild(p);
      });
    });
  }
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', sukeshDasLightboxCaptions);
  } else {
    sukeshDasLightboxCaptions();
  }
  window.addEventListener('mercury:load', sukeshDasLightboxCaptions);
})();
</script>

It copies each caption from .gallery-caption-content into the matching .gallery-lightbox-item, using plain JavaScript and textContent, so no jQuery and no risk of injected HTML. Then style it with Custom CSS:

/* Lightbox caption styles by Sukesh Das, sukeshdas.com */
.gallery-lightbox-item .sd-lightbox-caption {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: 80%;
  margin: 0;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 15px;
  text-align: center;
  border-radius: 6px;
}

How do I style Squarespace carousel arrows?

Once the carousel moves on its own, the arrows become a secondary control, so I usually make them smaller and calmer. Here is CSS for list section carousel arrows and summary block arrows:

/* Carousel arrow styling by Sukesh Das, sukeshdas.com */
.user-items-list-carousel__arrow-button {
  width: 44px !important;
  height: 44px !important;
  background: #ffffff !important;
  border: 1px solid #d9d9d9 !important;
  border-radius: 50% !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.user-items-list-carousel__arrow-button svg {
  stroke: #1a1a1a !important;
}
.summary-carousel-pager-next,
.summary-carousel-pager-prev {
  opacity: 0.6;
  transition: opacity 0.2s ease;
}
.summary-carousel-pager-next:hover,
.summary-carousel-pager-prev:hover {
  opacity: 1;
}

Keep the arrows at least 44 pixels square. Smaller buttons are hard to tap on a phone. Do not hide the arrows completely with display: none, because the autoplay script clicks them, and because visitors who turned off motion still need a way to move through the slides. If you want them invisible on desktop, use opacity: 0 and show them on hover instead.

A quick note from client work, because picking the right section saves a lot of custom code later:

  • Testimonials and team members: a list section in carousel layout. Easy to edit, and it works well with autoplay at a slower speed.
  • Latest blog posts or products: a summary block in carousel layout. It updates itself when you publish. I share more blog styling in my Squarespace blog CSS guide.
  • Full-width photos: a gallery slideshow, using its built-in autoplay if your layout offers it.
  • Portfolio strips: a gallery reel, with autoplay from the script and lightbox captions.
  • Client logos: not a carousel at all. Use the Squarespace logo slider code instead.

For product sliders on store pages, see my guide to Squarespace store page customization.

How should I check my carousels after adding the code?

I run through the same short list on every site before I hand it back to a client. It takes five minutes and catches nearly every problem.

  • Open the live page in a private window and wait for at least two slide changes, so you know the timer is running and not just the first click.
  • Hover over each carousel and confirm it stops, then move away and confirm it starts again.
  • Open the page on a real phone, not only the browser’s mobile preview. Swipe through a few slides by hand and check that autoplay picks up again afterwards.
  • Click a menu link to another page and come back. If autoplay keeps working after that, the AJAX support is doing its job.
  • Switch on reduce motion in your phone’s accessibility settings and reload. The carousels should sit still, and the arrows should still work.
  • Open the browser console with F12 and look for red errors. A clean console means no other script on the page is getting in the way.

One more thing I always tell clients: autoplay is a design choice, not a requirement. A carousel that moves gets more eyes on the first few slides, but people rarely wait for slide eight. Put your strongest testimonial or project first, keep the number of slides sensible, and let the movement do the rest.

If something on this list fails and you can’t see why, compare the class names in your browser’s Inspect panel with the selectors in my script. Squarespace sometimes changes markup, and a renamed arrow class is the first thing I check.

Squarespace carousel autoplay FAQs

Does Squarespace have carousel autoplay built in?

Only for some layouts. Gallery slideshows and the older Gallery Block can offer autoplay in their design settings, and the scrolling block moves text on its own. List section carousels, summary block carousels and gallery reels need a script.

Where do I paste the Squarespace carousel autoplay script?

In Website, Pages, Custom Code, Code Injection, Footer. It needs a Core, Plus or Advanced plan, or an older Business or Commerce plan.

How do I change the autoplay speed?

Change the speed value in the SETTINGS object. It is in milliseconds, so 5000 is five seconds between slides.

Can I autoplay only one carousel on a page?

Yes. Add that section’s data-section-id to the onlySections list in the SETTINGS object. Every other carousel stays manual.

Why does autoplay only work after I refresh?

Squarespace loads pages with AJAX. My script listens for the mercury:load event, so it starts again when a page changes without a full reload.

Will autoplay work on mobile?

Yes. It clicks the same next arrow Squarespace uses on mobile, and it pauses while a finger is touching the carousel.

How do I make a logo marquee in Squarespace?

Use a Code Block that repeats the logos and moves the row with a CSS animation. My Squarespace logo slider guide has free code for it.

How do I stop the carousel when someone hovers over it?

Set pauseOnHover to true in the script. It also pauses on touch and keyboard focus.

What is prefers-reduced-motion and why does it matter?

It is a browser setting for people who want less movement on screen. Autoplay and marquees should stop for those visitors, and my code does that automatically.

How do I show two gallery columns on mobile?

Set grid-template-columns: repeat(2, 1fr) on .gallery-grid-wrapper inside a media query for screens 767px wide or smaller.

Want me to set up your carousels?

If you would rather not touch code, I can set up Squarespace carousel autoplay, a logo marquee and the styling around it so it matches your brand and works on every screen. I build and support Squarespace sites every week as a Squarespace web designer. Send me a short brief and I will reply within one working day.

Start the discussion

Questions are welcome. I usually reply within a day. Your email stays private and comments are checked before they appear.

Booking new projects

Want this done for you?

If this article describes your website, send me the details. I reply by email with next steps.

Sukesh Das

Usually replies within 4 hours9 AM to 11 PM, Bangladesh time