Building a Looping Carousel of Logos and Content in Webflow with Spline.js

Published on
February 28, 2023

Building a Looping Carousel of Logos and Content in Webflow Using Spline.js

In this tutorial, we will be exploring how to set up a looping carousel of logos and content using spline.js in Webflow. Spline.js is a lightweight, flexible library for creating carousels and sliders. We will cover the process of setting up the looping carousel, including importing the necessary scripts, setting up the structure in Webflow, customizing the carousel, utilizing CMS for dynamic content, handling breakpoints, and integrating intersection to trigger autoplay.

Getting Started with Spline.js

Spline.js is a popular choice for creating carousels due to its simplicity and flexibility. It offers a variety of options for customization, making it a great fit for a wide range of projects.

Importing the Necessary Scripts

To get started with spline.js, the first step is to import the necessary scripts. We will be grabbing the JavaScript and CSS files from the CDN to include them in our Webflow project.

To import the spline.js script, you can follow these steps:

  1. Find the CDN for the spline.js library. You can obtain this from the official site or from a reliable source such as JS deliver.
  2. Copy the script tag for the JavaScript file.
  3. Paste the script tag inside the <body> tag of your Webflow project.
  4. Next, copy the CSS link for spline.js and paste it inside the <head> tag of your Webflow project.

By importing these scripts, you've set the stage for integrating spline.js into your Webflow project.

Setting up the Structure in Webflow

Now that we have imported the necessary scripts, it's time to set up the structure for our looping carousel in Webflow. Let's create the necessary elements and apply the required classes.

Here is a step-by-step guide to setting up the carousel structure in Webflow:

  1. Create a section or a container in your Webflow project where you want to display the looping carousel.
  2. Inside the section, add a div block and give it a unique ID, such as "splide", which will be used to reference the carousel in the custom code.
  3. Within the "splide" div, add three additional div blocks: "splidetrack", "splidelist", and "splide__slide".

The structure for the looping carousel is now set up, and it's time to populate it with content.

With the structure in place, you can now add the logos or content to the carousel. Follow these steps to populate the carousel with logos:

  1. Within the "splide__slide" div, add an image for each logo you want to display in the carousel.
  2. Duplicate the image div to include multiple logos.
  3. Ensure that the necessary styles and classes are applied to the div blocks for proper layout and display.

After populating the carousel with logos, you can also create another carousel instance for text content by following a similar process. This allows you to have separate carousels for logos and text content within the same Webflow project.

Once the structure and content are set up, you can customize the carousel by adding custom code to enhance its functionality. This includes modifying options such as the number of slides per page, enabling/disabling arrows and pagination, and setting the carousel to loop continuously.

Here are some customization options you can consider:

  1. Setting the Number of Slides Per Page: Use the "perPage" option to control the number of slides displayed per page. For example, setting "perPage: 5" will display five slides at a time.

  2. Disabling Arrows and Pagination: You can disable the default arrow and pagination controls by setting "arrows: false" and "pagination: false" in the carousel options.

  3. Enabling Continuous Looping: Ensure that the carousel continues to loop seamlessly by setting "type: 'loop'" in the carousel options, allowing the content to loop endlessly.

  4. Handling Breakpoints: Configure the carousel to adapt to different screen sizes by using breakpoints. Customize the number of slides per page and other options based on specific screen widths to ensure a responsive carousel experience.

Integrating CMS for Dynamic Content

Webflow's CMS (Content Management System) allows you to create dynamic content-driven carousels. You can integrate the CMS to dynamically populate the carousel with logos, text, or other content.

Follow these steps to integrate the CMS into the carousel:

  1. Set up a collection in Webflow for the logos or content you want to showcase in the carousel.
  2. Add a collection list inside the “splide__slide” div to pull dynamic content from the CMS collection.
  3. Utilize the collection fields to populate the carousel with dynamic content.

By integrating the CMS, you enable the client to manage the carousel content dynamically through the Webflow Editor, eliminating the need for manual updates.

Handling Autoplay Triggered by Intersection

Spline.js offers an intersection extension that enables you to start autoplay when the carousel scrolls into view and pause autoplay when it scrolls out of view. By utilizing intersection, you can ensure that the carousel begins playing only when it becomes visible in the viewport.

Here are the steps to set up autoplay triggered by intersection:

  1. Import the intersection extension script from the spline.js library using the provided CDN link.
  2. Customize the autoplay settings using the intersection extension, specifying when the autoplay should start and stop based on the carousel’s visibility in the viewport.

By incorporating this feature, you can enhance the user experience by ensuring that the carousel's autoplay is activated based on the user's interaction with the page.

Conclusion

In this tutorial, we have explored the process of setting up a looping carousel of logos and content using spline.js in Webflow. We covered the steps to import the necessary scripts, set up the structure in Webflow, customize the carousel, integrate dynamic content using Webflow’s CMS, handle breakpoints for responsive design, and trigger autoplay based on intersection visibility.

By following these steps, you can create engaging and dynamic carousels for your Webflow projects, offering a seamless user experience and empowering clients to manage and update content with ease. With spline.js, the possibilities for creating versatile and visually appealing carousels are virtually endless, providing a powerful tool for designers and developers using Webflow.