New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responsive Example #388

Open
cadday opened this Issue Jul 30, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@cadday

cadday commented Jul 30, 2018

Would someone please provide a responsive example. I like to define slidesToShow properties for different breakpoints.
Thanks

@cadday

This comment has been minimized.

cadday commented Aug 3, 2018

Anyone?
Is it even possible to change totalSlides based on window width?

@BowlingX

This comment has been minimized.

BowlingX commented Aug 6, 2018

You could use https://github.com/contra/react-responsive to render the Carousel component with different props.

@richardscarrott

This comment has been minimized.

richardscarrott commented Oct 24, 2018

@cadday I wondered the same -- but I was hoping it would compute the slidesToScroll based on the size of the container / viewport. That way you wouldn't have to define explicit slidesToScroll at specific breakpoints allowing the carousel to scale based on a percentage width.

It would require reading the item width from the DOM before being able to compute the page count -- or at least accepting the width of an item as a prop but it'd offer a lot of flexibility.

I remember implementing a carousel like this here http://richardscarrott.github.io/jquery-ui-carousel/ many years ago (try resizing the window).

@cadday

This comment has been minimized.

cadday commented Oct 25, 2018

@richardscarrott thanks for your answer. I think the idea of computing slide count automatically sounds good by i don't think it is practical.

It is not just the screen width that changes when switched from a desktop size to mobil size. Orientation change should also be considered.

For example, user might want to hide detail text on smaller screens and this can cause a necessity to show more items on smaller screen than large ones. Or lets say carousel items are structred as image on left text on right. On smaller screens user might want to change the structure and shows image up text bottom. This scenario also causes a necessity showing more or same number of items on smaller screens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment