Variable speed

nis's Avatar

nis

23 Oct, 2012 07:58 AM

Hello Dmitry,

Is it possible to set the transition speed on click? If there are many slides, and you transition from one end to the other, it's hard to see what's going on. What I'd like to do, is to find the distance from the current to the next slide, and then multiply that with a variable to get a fixed speed.

(Pseudo code):

sliderInstance.ev.on('rsBeforeSlideChange', function() {
   var currSlide = sliderInstance.currSlide; //1
   var nextSlide = sliderInstance.nextSlide; //3
   var speedPerSlide = 200;
   var newSpeed = nextSlide - currSlide * speedPerSlide; // 3-1*200 = 400

   gotoSlide(nextSlide, newSpeed); // Will transition from slide 1 to 3 over 400ms 
});

(I am well aware the above code will not work – it is merely to illustrate what I want.)

The result would be, that the speed would remain the same, but it would simply take longer to transition when the distance is longer. For example, it would take 200ms to transition between slide 1 and slide 2, but 400ms to transition between slide 1 and slide 3, 600ms between slide 1 and 4 and so on.

Does that make sense? Is it possibly with the current version without too much changes to the core, and how do you suggest I implement it?

  1. Support Staff 1 Posted by Dmitry Semenov on 23 Oct, 2012 03:50 PM

    Dmitry Semenov's Avatar

    Hello,

    Honestly, I don't really understand what for you're trying to do this. But slide transiton speed you can change like this:

    $('.yourRoyalSlider').data('royalSlider').st.transitionSpeed = 100;
    

    Hope that's what you need.

    Dmitry

  2. nis closed this discussion on 05 Dec, 2012 09:43 AM.

Comments are currently closed for this discussion. You can start a new one.

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