Splidejs / splide

Splide is a lightweight, flexible and accessible slider/carousel written in TypeScript. No dependencies, no Lighthouse errors.
https://splidejs.com
MIT License
4.83k stars 418 forks source link

Add slide to multiple sliders #1205

Closed janklubus closed 1 year ago

janklubus commented 1 year ago

Checks

Version

v3.6.8

Description

Hi, I have multiple sliders on the same page and this is mounted in a loop:

for (var i = 0; i < elms.length; i++) { var splide = new Splide(elms[i], { ... ... } splide.mount(); }

Now I need to dynamically add a slide to all these sliders. If I use the splide.add(html) code, it only adds the slide to the last slider.

I tried the destroy and remount method, but it also only works for the last slider.

Can someone help me?

Reproduction Link

No response

Steps to Reproduce

  1. Mount multiple sliders (one variable name)
  2. Dynamically add a slide to all of them

Expected Behaviour

splide.add() adds slide to all instances.