kenwheeler / slick

the last carousel you'll ever need
kenwheeler.github.io/slick
MIT License
28.47k stars 5.89k forks source link

slickGoTo scrolls slides differently then when sliding one by one #148

Closed burgalon closed 10 years ago

burgalon commented 10 years ago

When using slickGoTo(x) and slidesToShow= 3, the carousel scrolls to show only 1 slide leaving 2 slots empty. e.g:

[1 2 3] 4 -----slickGoTo(4) ---> 1 2 3 [4 ] instead of [1 2 3] 4 -----slickGoTo(4) ---> 1 [ 2 3 4 ]

See example on GiraffeList - Scroll the top carousel to the rightmost item. This will cause the lower carousel to call slickGoTo(..)

kenwheeler commented 10 years ago

Are you using the most recent version?

kenwheeler commented 10 years ago

@burgalon did the update fix this for you?

burgalon commented 10 years ago

@kenwheeler New version resolves this issue It seems like there were some API changes with onBeforeChange. Instead of passing animSlide it is now passing _.currentSlide. Can we add animSlide as a third parameter?

        if (_.options.onBeforeChange !== null && index !== _.currentSlide) {
            _.options.onBeforeChange.call(this, _, animSlide);
        }