How can I make a slider start on a different image each time the page loads in Webflow while maintaining the order of the images?

Published on
September 22, 2023

To make a slider start on a different image each time the page loads in Webflow while maintaining the order of the images, you can follow these steps:

  1. Arrange your images in the desired order: Make sure your images are arranged in the correct sequence in the slider element.

  2. Add a custom attribute to each slide: For each slide in the slider, add a custom attribute using the "data" attribute. For example, you can use "data-slide-index" and assign a unique number to each slide. The first slide would have "data-slide-index='1'", the second slide would have "data-slide-index='2'", and so on.

  3. Add custom code to the page: Go to the page settings and select the Custom Code tab. Add the following code to the <head> section of the page:

    ```html

    ```

  4. Initialize the slider and shuffle the slides: In the same Custom Code tab, add the following code to the <body> section of the page:

    ```html

    ```

    Replace "slider-id-here" with the actual ID of your slider element.

  5. Publish the site and test: Once you've added the code, publish the site and test if the slider starts on a different image each time the page loads while maintaining the original order of the images.

By following these steps, you can achieve a randomized starting image for your slider in Webflow, while keeping the original image order intact.

Additional Questions:

  1. How can I add a custom attribute to a slide in a Webflow slider?
  2. Can I change the animation style of the Webflow slider?
  3. How can I create an auto-playing slider in Webflow?