pull/1/head
Jan Umbach 2024-05-29 21:09:10 +02:00
parent eecb304db7
commit 53847141ea
1 changed files with 9 additions and 0 deletions

View File

@ -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();
}