kenwheeler / slick

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

Filtering and Swiping #1929

Open aelur opened 8 years ago

aelur commented 8 years ago

hello! First of all thanks for your awesome work. Sadly, I'm having some problems using slick as a carousel; I have a large number of slides, which I have to filter. What happens is that, once it's filtered, the swipe calculates the number of slides based on a difference between an array index and the slide index, which of course, is not right since slide indexes are not recalculated.

 Slick.prototype.getSlideCount = function() {
       (...)
      slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1;

cheers!

kenwheeler commented 8 years ago

jsfiddle?

aelur commented 8 years ago

Sorry for the delay, here it is

https://jsfiddle.net/zzydvuhm/2/

Notice when I filter it, when you swipe it sometimes it just brings you back to the first slide, because it's calculating the difference between the index of the slide and the index of the array you set up in the code with the filtered slides.

ahmadalfy commented 8 years ago

Your jsfiddle wasn't working because you are not using the resources from the CDN. I updated it and here it is https://jsfiddle.net/ahmad/zzydvuhm/4/

Still I cannot idenfity the problem

aelur commented 8 years ago

My bad, I hadn't updated the fiddle and lost the changes. Could you try this link?

https://jsfiddle.net/zzydvuhm/7/

Try swiping back and forth a couple of time, you'll notice that some times the swiping just takes you back way too many slides. It's not working properly.

Thanks!

On 3 December 2015 at 11:43, Ahmad Alfy notifications@github.com wrote:

Your jsfiddle wasn't working because you are not using the resources from the CDN. I updated it and here it is https://jsfiddle.net/ahmad/zzydvuhm/4/

Still I cannot idenfity the problem

— Reply to this email directly or view it on GitHub https://github.com/kenwheeler/slick/issues/1929#issuecomment-161659784.