Unnikrishnan R
Unnikrishnan R

Reputation: 146

How to use slickGoTo for sliding directly to an non adjacent slide without seeing all the slides in between?

I am using a slick slider which shows one slide as active. I can use the arrows to navigate between the slides What i am looking for is a way to go to a particular slide directly from the current slide without sliding all the slides in between.. For example if I am going from slide 1 to slide 4 using slickGoTo now it slides like 1..2..3..4 .. What i want is to go from 1 directly to 4 just like 1..4 witout sliding through 2 and 3.

See this codepen

$('.sl1').slick("slickGoTo", 4);

In short what i want is to make going from 1 to 4 look exactly like going from 1 to 2..

Upvotes: 0

Views: 696

Answers (1)

niklas
niklas

Reputation: 3011

You are missing the point about sliders. Its like a carousel, where you have to pass every element on order to get to the others. However when you change set fade: true in slick initialization you will get your desired result (without sliding).

$('.sl1').slick({
  initialSlide: 0,
  autoplay: false,
  arrows:true,
  fade: true
});

https://codepen.io/niklasp-the-looper/pen/JmmmKO

Upvotes: 0

Related Questions