class SlickSlider {
constructor(id, countShow, countScroll, idArrows, idDots) {
this.elem = id;
this.slidesToShow = countShow;
this.slidesToScroll = countScroll;
this.appendArrows = $(idArrows);
this.appendDots = $(idDots);
this.responsives = [];
}
get initSlider() {
return this.init();
}
init() {
let options = this.slider();
if (this.responsives) {
options.responsive = this.responsives;
}
$(this.elem).slick(options);
}
slider() {
return {
slidesToShow: this.slidesToShow,
slidesToScroll: this.slidesToScroll,
dots: true,
appendArrows: this.appendArrows,
appendDots: this.appendDots,
touchThreshold: 10
}
}
addResponsive(weight, mobileShow, mobileScroll) {
let obj = {
breakpoint: weight,
settings: {
slidesToShow: mobileShow,
slidesToScroll: mobileScroll
}
};
this.responsives.push(obj);
}
}
let slider = new SlickSlider('.slider-item-four', 4, 1, '.slider-control-four', '.slider-control-four .slider-dots');
slider.addResponsive(1680,3,1);
slider.addResponsive(1580, 2, 1);
slider.initSlider;