Skip to content

Commit

Permalink
fix(core): prevent observer updates on loop fix
Browse files Browse the repository at this point in the history
fixes #7135
  • Loading branch information
nolimits4web committed Oct 25, 2023
1 parent e6f76d5 commit 7a5eacc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/loop/loopFix.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default function loopFix({
byMousewheel,
} = {}) {
const swiper = this;

if (!swiper.params.loop) return;
swiper.emit('beforeLoopFix');
const { slides, allowSlidePrev, allowSlideNext, slidesEl, params } = swiper;
Expand Down Expand Up @@ -114,6 +115,10 @@ export default function loopFix({
}
}
}
swiper.__preventObserver__ = true;
requestAnimationFrame(() => {
swiper.__preventObserver__ = false;
});
if (isPrev) {
prependSlidesIndexes.forEach((index) => {
slides[index].swiperLoopMoveDOM = true;
Expand Down

0 comments on commit 7a5eacc

Please sign in to comment.