fixed gallery next butten disabled

pull/1/head
Jan Umbach 2024-05-29 21:41:48 +02:00
parent 0c652ba778
commit fc2e437756
1 changed files with 3 additions and 15 deletions

View File

@ -634,9 +634,7 @@ class SliderComponent extends HTMLElement {
}
initPages() {
this.sliderItemsToShow = Array.from(this.sliderItems).filter((element) => { return element.style.display !== 'none' });
console.log('sliderItemsToShow', this.sliderItemsToShow);
this.sliderItemsToShow = Array.from(this.sliderItems).filter((element) => element.clientWidth > 0);
if (this.sliderItemsToShow.length < 2) return;
@ -648,20 +646,12 @@ class SliderComponent extends HTMLElement {
this.totalPages = this.sliderItemsToShow.length - this.slidesPerPage + 1;
console.log('totalPages', this.totalPages);
this.update();
}
resetPages() {
setTimeout(() => {
this.slider = this.querySelector('[id^="Slider-"]');
this.sliderItems = this.querySelectorAll('[id^="Slide-"]');
this.initPages();
console.log('resetPages', this.totalPages, this.currentPage, this.slider.scrollLeft, this.sliderItemOffset);
console.log("resetPages this", this);
}, 500);
this.sliderItems = this.querySelectorAll('[id^="Slide-"]');
this.initPages();
}
update() {
@ -672,8 +662,6 @@ class SliderComponent extends HTMLElement {
const previousPage = this.currentPage;
this.currentPage = Math.round(this.slider.scrollLeft / this.sliderItemOffset) + 1;
console.log('currentPage', this.currentPage, 'totalPages', this.totalPages, 'previousPage', previousPage);
if (this.currentPageElement && this.pageTotalElement) {
this.currentPageElement.textContent = this.currentPage;
this.pageTotalElement.textContent = this.totalPages;