Skip to main content

Create slider from string/array that is not attached to DOM

If you need to create slider with slides that are not attached to DOM, this method is for you.

First of make sure that root slider node is attached to DOM.

<div class="royalSlider rsDefault">
<!-- this content will be ignored if you add slides option -->
</div>

Then simply initialize slider with slides option (option accepts HTML string that contains list of slides):

$('.royalSlider').royalSlider({
// optionally other options
slides: '<a class="rsImg" href="/img/image1.jpg">1<span class="rsTmb">thumbnail text 1</span></a><a class="rsImg" href="/img/image2.jpg">2<span class="rsTmb">thumbnail text 2</span></a>'
});