Webflow sync, pageviews & more.
NEW

How can I create buttons in Webflow that link to specific slides in a slider? I've tried using unique IDs for the slides and images but they're not working. Thank you, David.

  1. Set Up Your Slider and Buttons
  • Add a Slider element to your page.
  • Give the slider a unique class (e.g., "custom-slider").
  • Create buttons for each slide and assign a unique class (e.g., "slide-link-btn").
  • Add a custom attribute to each button (e.g., data-slide="1", data-slide="2", etc.) corresponding to the slide index (zero-based for some implementations).
  1. Add Custom Code for Slide Navigation
  • In Project Settings or the page's Footer Code area, insert a script that listens for button clicks.

  • Use jQuery to target the buttons and, on click, retrieve the data-slide attribute.

  • Access the slider instance via its class and call its built-in goToSlide method with the target index.

    Example inline instructions (adjust as needed):
    • On click, use code similar to:
    • Select the slider element: var slider = $(".custom-slider")[0].slider;
    • Then call slider.goToSlide(targetIndex);
    (Remember to ensure your slider library is loaded—Webflow does that automatically.)

  1. Test and Adjust
  • Publish your site and test each button.
  • Verify that clicking a button takes you to the corresponding slide.
  • Refine the indices if your slider starts counting from 0 or 1.

Key Takeaway

Unique IDs on slides won’t work because Webflow’s slider doesn’t natively link DOM IDs to slide positions; using custom attributes and a bit of JavaScript ensures smooth navigation between slider slides.

Rate this answer

Other Webflow Questions