I\'ve got a slider set up using slick slider. When using the next and previous buttons, the item comes in to view with a nice transition. The problem I\'m having is that when it
Here my hack for slick.js Warning!! use its carefully, cause its alter source code of plugin
1) Find function
Slick.prototype.setSlideClasses
and replace its definition
from
Slick.prototype.setSlideClasses = function(index)
to
Slick.prototype.setSlideClasses = function(index, oldSlide)
2) in body of this function after code
_.$slides
.eq(index)
.addClass('slick-current');
add
if(oldSlide!=undefined){
if(index==0 && oldSlide!=1){
var _current = this.$slides.eq(this.$slides.size()-1);
var __index = allSlides.index(_current);
var ss = allSlides.eq(__index+1);
ss.addClass('slick-current');
}
if(index==this.$slides.size()-1 && oldSlide!=this.$slides.size()-2){
var _current = this.$slides.eq(0);
var __index = allSlides.index(_current);
var ss = allSlides.eq(__index-1);
ss.addClass('slick-current');
}
}
3) find function Slick.prototype.slideHandler in its body replace call
oldSlide = _.currentSlide;
_.currentSlide = animSlide;
_.setSlideClasses(_.currentSlide);
to
oldSlide = _.currentSlide;
_.currentSlide = animSlide;
_.setSlideClasses(_.currentSlide,oldSlide);