diff --git a/src/modules/mousewheel/mousewheel.mjs b/src/modules/mousewheel/mousewheel.mjs index e5699f06f..96a3f8501 100644 --- a/src/modules/mousewheel/mousewheel.mjs +++ b/src/modules/mousewheel/mousewheel.mjs @@ -363,6 +363,7 @@ export default function Mousewheel({ swiper, extendParams, on, emit }) { lastEventBeforeSnap = newEvent; recentWheelEvents.splice(0); timeout = nextTick(() => { + if (swiper.destroyed || !swiper.params) return; swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); }, 0); // no delay; move on next tick } @@ -371,6 +372,7 @@ export default function Mousewheel({ swiper, extendParams, on, emit }) { // we'll consider a scroll "complete" when there haven't been any wheel events // for 500ms. timeout = nextTick(() => { + if (swiper.destroyed || !swiper.params) return; const snapToThreshold = 0.5; lastEventBeforeSnap = newEvent; recentWheelEvents.splice(0);