Replacing all slides dynamically
If you need to change all slides in your gallery completely, it's more efficient to destroy old one and initialize new than using
Thanks to jQuery chaining, there is very elegant solution how to do this. Assuming that you already have initialized slider with css selector
.royalSlider on your page.
slides: '<div>New slide 1</div><div>New slide 2</div>',
// other options... for example:
What this code does:
- Destroys old slider instance
- Cleans up all elements inside .royalSlider.
- Initializes new one with new slides that are passed through
As you probably already understood instead of
<div>New slide 1</div> you should put HTML markup for first slide,
<div>New slide 2</div> for second e.t.c.