Skip to content

Commit

Permalink
fix(virtual): grab DOM slides only from wrapper children
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Feb 10, 2023
1 parent c89b2dd commit d59183d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/modules/virtual/virtual.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ export default function Virtual({ swiper, extendParams, on, emit }) {
if (!swiper.params.virtual.enabled) return;
let domSlidesAssigned;
if (typeof swiper.passedParams.virtual.slides === 'undefined') {
const slides = swiper.slidesEl.querySelectorAll(`.${swiper.params.slideClass}, swiper-slide`);
const slides = [...swiper.slidesEl.children].filter((el) =>
el.matches(`.${swiper.params.slideClass}, swiper-slide`),
);
if (slides && slides.length) {
swiper.virtual.slides = [...slides];
domSlidesAssigned = true;
Expand Down

0 comments on commit d59183d

Please sign in to comment.