test
parent
eecb304db7
commit
53847141ea
|
@ -635,12 +635,21 @@ class SliderComponent extends HTMLElement {
|
|||
|
||||
initPages() {
|
||||
this.sliderItemsToShow = Array.from(this.sliderItems).filter((element) => element.clientWidth > 0);
|
||||
|
||||
console.log('sliderItemsToShow', this.sliderItemsToShow);
|
||||
|
||||
if (this.sliderItemsToShow.length < 2) return;
|
||||
|
||||
this.sliderItemOffset = this.sliderItemsToShow[1].offsetLeft - this.sliderItemsToShow[0].offsetLeft;
|
||||
|
||||
this.slidesPerPage = Math.floor(
|
||||
(this.slider.clientWidth - this.sliderItemsToShow[0].offsetLeft) / this.sliderItemOffset
|
||||
);
|
||||
|
||||
this.totalPages = this.sliderItemsToShow.length - this.slidesPerPage + 1;
|
||||
|
||||
console.log('totalPages', this.totalPages);
|
||||
|
||||
this.update();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue