slidesPerColumn param update does not correctly render slides
See original GitHub issueCodeSandbox: https://codesandbox.io/s/reactidswiper-slidespercolumn-update-issue-bww36?fontsize=14
What you did I am updating the slidesPerColumn param on window resize and re-rendering Swiper component with shouldSwiperUpdate set to true eg:
useEffect(
() => {
if (swiper !== null) {
swiper.on("resize", () => {
if (window.innerWidth < 1024) {
swiper.params.slidesPerColumn = 1
swiper.params.slidesPerView = 1
} else {
swiper.params.slidesPerColumn = 3
swiper.params.slidesPerView = 2
}
swiper.update();
});
}
},
[swiper]
);
Expected Behavior Swiper should display 3 slides per column inside the Swiper container when window size > 1024
Actual Behavior Swiper displays only 1 slide per column at 100% of container height. slidesPerView renders correctly
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Can you modify the number of slidesPerView in swiperjs after ...
Solved it by modify the params. let params = swiperModify.params; params.slidesPerView = 3; params.slidesPerColumn = 3;.
Read more >Swiper Changelog
a11y: update slides a11y on slides amount change (31e2005), closes #5692 ... Fixed issue when SwiperSlide was not rendered if used with v-for ......
Read more >How to Build a Slideshow App Using Swiper and Angular
In this post, we will build a slideshow app with the ability to render one slide at a time using Angular, Swiper, and...
Read more >Framework7 Release Notes
Fixed issue when it rendered not correctly without icon ... autoScrollOffset parameter that allows to set on what thumbs active slide from edge...
Read more >Team:CMUQ/swiperjs - iGEM 2019
textContent = text; } return this; } function is(selector) { var el = this[0]; var compareWith; ... Calc slides var slideSize; var slidesPerColumn...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have got it working on page load by setting init: false and then setting params before calling swiper.init()
eg:
However, it still does not update responsively on resizing and I am not sure how to handle this. I don’t think to destroy and recreate the swiper on each resize is feasible. Even if setting a timeout and waiting for a ‘done resizing’ event.
the answer is here