diff --git a/src/core/breakpoints/setBreakpoint.mjs b/src/core/breakpoints/setBreakpoint.mjs index 453f9ef47..6b6bee701 100644 --- a/src/core/breakpoints/setBreakpoint.mjs +++ b/src/core/breakpoints/setBreakpoint.mjs @@ -10,8 +10,10 @@ export default function setBreakpoint() { const breakpoints = params.breakpoints; if (!breakpoints || (breakpoints && Object.keys(breakpoints).length === 0)) return; - // Get breakpoint for window width and update parameters - const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el); + // Get breakpoint for window/container width and update parameters + const breakpointsBase = params.breakpointsBase === 'window' || !params.breakpointsBase ? params.breakpointsBase : 'container'; + const breakpointContainer = ['window', 'container'].includes(params.breakpointsBase) || !params.breakpointsBase ? params.el : document.querySelector(params.breakpointsBase); + const breakpoint = swiper.getBreakpoint(breakpoints, breakpointsBase, breakpointContainer); if (!breakpoint || swiper.currentBreakpoint === breakpoint) return;