Remove first slide without repositioning

guille's Avatar

guille

20 Sep, 2012 06:15 PM

Hello

i would like to remove a first slide whilst being on a second. But when i do that, the third slide is shown.
How could i solve that?

I tried to call goto(0) but than the slider animates from the (now) second slide to the first.

I just want to remove the first slide without the user noticing that (without animations)

thanks,
Guille

  1. Support Staff 1 Posted by Dmitry Semenov on 21 Sep, 2012 07:35 AM

    Dmitry Semenov's Avatar

    Hi,

    Not sure if there won't be any issues, but in theory this should work:

    var rs =  $('.royalSlider').data('royalSlider');
    rs.currSlideId = rs.currSlideId - 1; 
    rs.removeSlide(0);
    

    Dmitry

  2. Support Staff 2 Posted by Dmitry Semenov on 21 Sep, 2012 07:56 AM

    Dmitry Semenov's Avatar

    additional note

    Unfortunately, it becomes more complex if you want to do this without animation. You'll have to reset -PREFIX-transition CSS property and slider.st.transitionSpeed slider option to 0 before reorering and revert to normal after it so it won't animate.

    To make this code work, you'll have to use unminified version of script to get access to local properties.

    var rs =  $('.royalSlider').data('royalSlider');
    var oldSpeed = rs.st.transitionSpeed;
    rs.currSlideId = rs.currSlideId - 1; 
    rs._slidesContainer.css((rs._vendorPref + rs._TD), '0ms');
    rs.st.transitionSpeed = 0; 
    rs.removeSlide(0); 
    setTimeout(function() { rs.st.transitionSpeed = oldSpeed; }, 100);
    

    But you'll still notice short "flicker", especially on mobile devices because of rendering issues.

    Dmitry

  3. 3 Posted by guille on 21 Sep, 2012 08:51 AM

    guille's Avatar

    Hmm..
    that's not really satisfying. You should definitely think about a "animate=true/false" parameter in the next, prev, goto and removeSlide functions :)

    By any chance.. Is there a way to "switch off" the first slide without removing it?
    This could help too

  4. Support Staff 4 Posted by Dmitry Semenov on 22 Sep, 2012 07:08 PM

    Dmitry Semenov's Avatar

    You may simply remove content from slide, it depends on your situation.

    Dmitry

  5. 5 Posted by guille on 23 Sep, 2012 01:20 PM

    guille's Avatar

    If i just remove the content, the left arrow of the slider is still switched on..

    Well.. i think i am going to just deactivate the left arrow automatically or something.

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