Skip to content

Commit

Permalink
fix(element): fix missing elements part when added dynamically
Browse files Browse the repository at this point in the history
fixes #6899
  • Loading branch information
nolimits4web committed Aug 8, 2023
1 parent b1ac56d commit db5b5d6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components-shared/update-swiper.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ function updateSwiper({
if (swiper.isElement && (!paginationEl || typeof paginationEl === 'string')) {
paginationEl = document.createElement('div');
paginationEl.classList.add('swiper-pagination');
paginationEl.part.add('pagination');
swiper.el.appendChild(paginationEl);
}
if (paginationEl) currentParams.pagination.el = paginationEl;
Expand All @@ -174,6 +175,7 @@ function updateSwiper({
if (swiper.isElement && (!scrollbarEl || typeof scrollbarEl === 'string')) {
scrollbarEl = document.createElement('div');
scrollbarEl.classList.add('swiper-scrollbar');
scrollbarEl.part.add('scrollbar');
swiper.el.appendChild(scrollbarEl);
}
if (scrollbarEl) currentParams.scrollbar.el = scrollbarEl;
Expand All @@ -187,13 +189,15 @@ function updateSwiper({
if (!nextEl || typeof nextEl === 'string') {
nextEl = document.createElement('div');
nextEl.classList.add('swiper-button-next');
nextEl.innerHTML = swiper.hostEl.nextButtonSvg;
nextEl.innerHTML = swiper.hostEl.constructor.nextButtonSvg;
nextEl.part.add('button-next');
swiper.el.appendChild(nextEl);
}
if (!prevEl || typeof prevEl === 'string') {
prevEl = document.createElement('div');
prevEl.classList.add('swiper-button-prev');
nextEl.innerHTML = swiper.hostEl.prevButtonSvg;
prevEl.innerHTML = swiper.hostEl.constructor.prevButtonSvg;
prevEl.part.add('button-prev');
swiper.el.appendChild(prevEl);
}
}
Expand Down

0 comments on commit db5b5d6

Please sign in to comment.