Wondering how to "restart" the gallery after changing the contents of the div

rod's Avatar

rod

30 Sep, 2012 09:12 PM

Hello,

I am pulling the links for the images used in my gallery from picassa. It works great the first time. But if a user wants to see a different gallery, then I call .empty() on the div container, fill it with new images, then call this again to start it again:
$('#gallery').royalSlider({...options...});

The problem is that it doesn't start. I found the page that showed how to remove / add a single slide, but since I have 20 or so, that seems inefficient. What is the proper way to do this?

thank you,

Rod

  1. Support Staff 1 Posted by Dmitry Semenov on 01 Oct, 2012 06:23 AM

    Dmitry Semenov's Avatar

    HI,

    If you're changing all of the slides, it'll be better simply to destroy old gallery and add and initialize new one.

    Dmitry

  2. 2 Posted by rod on 01 Oct, 2012 02:27 PM

    rod's Avatar

    Thank you!

    Can you tell me what that code would look like?

    I am starting the gallery like so:

    var mygallery = $('#gallery').royalSlider({...options...});

    So in the callback function, I remove all old items, then add all new ones. Then what call to I make to destroy the gallery?

    I tried something like this:

    mygallery = null;

    But it did not work.

    Thank you!

  3. Support Staff 3 Posted by Dmitry Semenov on 01 Oct, 2012 05:35 PM

    Dmitry Semenov's Avatar

    To destroy slider and remove it from DOM:

    $('#gallery').data('royalSlider').destroy(true);
    

    Dmitry

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac