Closed Ruben-check24 closed 5 months ago
t0ggles-create swiper
Task nolimits4web/SWIPER-88 was created
Swiper uses ResizeObserver to trigger the resize logic (for better performance), so if its size not changed it will do nothing. You can disable resizeObserver
parameter or use container
as a breakpoints base
Task nolimits4web/SWIPER-88 status changed to Done
thanks for looking into it and I get the rational behind it. I think it would be helpful to document this behaviour in the description for breakpoints
and breakpointsBase
Check that this is really a bug
Reproduction link
Bug description
Breakpoints work fine but as soon as I add a
min-width
to any parent Element of the swiper and its greater or equal to thebreakpoint
, it doesn't work reliably anymore when the window gets resized (slowly). I added amin-width
of1024px
on adiv
above the swiper (common thing to do on desktop is to have suchmin-width
on thebody
) and on the swiper I have a breakpoint at1024px
to show 5 slides. The effect/bug is even more noticeable/occurs more often when themin-width
of thediv
is greater than thebreakpoint
. You have to resize the window pretty fast for swiper to react to it correctly. WithbreakpointBase="container"
it seems to work perfectly fine.Similar Demo in react with different values which makes it more noticeable.
min-with
is much higher than thebreakpoint
: codesandboxDemo VIdeo
https://github.com/nolimits4web/swiper/assets/92583338/41c8a874-0f6c-4276-8d58-4074de183279
Expected Behavior
No matter the "resize speed", breakpoint should be handled correctly and reliably when a parent element has a 'min-width' set
Actual Behavior
When a parent Element has a min-width that is equal or larger than the breakpoint, the breakpoint does't trigger reliable anymore
Swiper version
11.1.0
Platform/Target and Browser Versions
macOS Chrome, Firefox, Safari
Validations
Would you like to open a PR for this bug?