I have a carousel/swiper that loads different images when in desktop or mobile mode. These two views seem to be working well, but for some reason BOTH images/carousels are displaying in tablet and mobile landscape mode.
It looks like the display settings are right in Tablet and Mobile Landscape (eg. mobile swiper = none) … can anyone share a fix for this?
Here is my site Read-Only:
On my end, both in Webflow and on the live site, I can only see one slider on each viewport
Thanks for taking a look! The issue shows up when you resize the browser window from desktop to mobile - I assume because it’s tracking through the intermediate breakpoints.
SwiperJS won’t know that you’re trying to hide/show it at specific breakpoints and that the CSS is changing. Likely it will be overriding that with style attributes as the slides switch.
To solve that, you want to place your breakpoint-specific visibility on a container element of the swiper DIV, rather than the swiper DIV itself.
You already have
mobile classes setup as global classes ( nice work ), so this is easy.
Click your swiper DIV in the navigator, and CTRL+ALT+G to wrap it in a new DIV. Do that for both. On the one wrapping your desktop swiper, assign the class
desktop. On the mobile one assign
I’d also remove those classes from the
swiper element just to keep the code clean.
That worked a treat! Thank you so much!
I really appreciated your step by step instructions.