diff --git a/src/implementations/vanilla/components/carousel/carousel.js b/src/implementations/vanilla/components/carousel/carousel.js index 78d09c1bd83..4c6137c310b 100644 --- a/src/implementations/vanilla/components/carousel/carousel.js +++ b/src/implementations/vanilla/components/carousel/carousel.js @@ -186,14 +186,14 @@ export class Carousel { this.cloneFirstSLide.remove(); this.cloneLastSLide.remove(); } - if (this.attachClickListener && this.toggle) { - this.toggle.removeEventListener('click', this.handleClickOnToggle); + if (this.toggle) { + this.toggle.replaceWith(this.toggle.cloneNode(true)); } if (this.attachClickListener && this.btnNext) { - this.btnNext.removeEventListener('click', this.shiftSlide); + this.btnNext.replaceWith(this.btnNext.cloneNode(true)); } if (this.attachClickListener && this.btnPrev) { - this.btnPrev.removeEventListener('click', this.shiftSlide); + this.btnPrev.replaceWith(this.btnPrev.cloneNode(true)); } if (this.slidesContainer) { this.slidesContainer.removeEventListener('touchstart', this.dragStart); @@ -206,7 +206,7 @@ export class Carousel { } if (this.navigationItems) { this.navigationItems.forEach((nav) => { - nav.removeEventListener('click', this.shiftSlide); + nav.replaceWith(nav.cloneNode(true)); }); } if (this.attachResizeListener) {