/    Sign up×
Community /Pin to ProfileBookmark

having trouble with Owl Carousel being responsive

Hi,
I need to build this carousel but I have a lot of trouble making it responsive.
What I would like is when there are 3 cards in a slide when the button is pressed all 3 of them move out of the container and on mobile if there is only one card when the button is pressed only one should move.

I tried doing it by separating the big slide and the cards and run javascript for each using matchMedia() but I didn’t even get to that as I have some other bugs.

Another problem I have is when the width of the windows is resized the first element is getting out of the view, plus for some reason, they do not fit the way that they should fit inside the slider. The container is blue and you can see that the first and last card is outside the container.
I tried to position them with javascript but then, after I position the cards too, the second pair of cards (second slide) is pushed way out to the left. I think is because it also calculates the with of the slider.

This is the codepen:
https://codepen.io/raul-rogojan/pen/vYZRrme?editors=0110

to post a comment
CSSHTMLJavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumSep 21.2021 — Take a look at swiper, it supports multiple slides per view:

https://swiperjs.com
×

Success!

Help @codyhill spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.12,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...