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
amp-carousel: breakpoint specific configuration #4626
Comments
/to @eike-hass Do you already have pages that exhibit this behavior? To confirm, you'd like a page to go from a scrolling carousel to a slideshow and back depending on As it stands, you can currently provide two components and toggle between them using |
@dvoytenko: currently there is no example. We imagined something similar to http://kenwheeler.github.io/slick/ (Responsive Display example). I think in parts this could achieved with the current state of |
@eike-hass If I understand you right, what you really want is to be able to provide breakpoints for how many slides to show at a time. E.g. it could be 1 slide on Is this what you want? If that's the case, I think it's a very reasonable extension to our current slideshows. |
@dvoytenko exactly. Would it make sense to also make behavior like |
@eike-hass |
Per @dvoytenko comment in #4642, here's an example that can benefit from this functionality: http://goo.gl/ZoJT73 |
@dvoytenko Did you consider making breakpoint specific "slides to scroll" available? |
@eike-hass Yes! We will do it. @ericlindley-g @rudygalfi We need to schedule this work. |
cc/ @cramforce I imagine #5981 affects how we'd approach this. If we deprecate amp-carousel types, the task in this feature request shifts from just changing At that point, I wonder if it's better just to rely on CSS breakpoints to hide/show two different components (though the downside is the extra markup and effort to implement), rather than implementing the behavior in the AMP library. Thoughts? |
The |
@ericlindley-g we are using the media attribute with three carousels at the moment which works quite well. We would like to get rid the bloat though. |
@cramforce and @ericlindley-g what's proposed here is very specific and, I believe, semantically valid use case. We currently have a slides component ( |
Its definitely a good argument to use an attribute to switch type which is On Fri, Nov 4, 2016 at 11:23 AM, Dima Voytenko notifications@github.com
|
The type doesn't switch here. It's still a slides component semantically: it still advances the same way (but group by group, not 1 by 1), the slides are still centered, etc. |
K. Maybe we should do nothing: But allow for a slide source argument to On Fri, Nov 4, 2016 at 11:28 AM, Dima Voytenko notifications@github.com
|
Ah, I see, there are essentially two behaviors to support for this request:
Alternately: an option to reduce the bloat without directly supporting (1) and (2) is to allow for slide source argument. +1 to reducing the bloat somehow. Something like slide source argument seems like a good idea; on the other hand I could see a show-this-many-slides-at-a-time parameter being useful as an option for amp-slides. Regardless of which of these (or another idea) is the right direction, it seems like a good item to roll into the other carousel improvement work (e.g. better visual affordance for number of items in the carousel). Slotting into "Next" for now, but open to feedback and +1s by anyone else in the community looking to support this use-case. As a side note, there are other component attributes that could benefit from breakpoint dependencies, as well, like amp-sidebar. Just brainstorming here, but if we build support for (1), one idea we could explore for (2) is a generalized way to change attributes based on breakpoints (or other signals—e.g. if we wanted to hook into the binding work somehow), with a whitelist of applicable component/attributes. |
We will need to come up with some kind of format to spec the breakpoint config media: {
'min-width:1024': {
slidesToShow: 3,
slidesToScroll: 3
},
'max-width:600': {
slidesToShow: 2,
slidesToScroll: 2
} Navigation There are 2 code-paths in the existing code.
With the media attribute
Onscroll We will also have to figureout what we do when scrolling stops , lets say there are four slides and user scrolled a slide and a half - with the current logic we will snap back to the first slide, but with the new approach since we show multiple slides we could ideally stop at slide 2. This might involve more math but doable Loops Overall
Given all these yes we could do this with the existing code without DOM duplication or restructuring |
This is exactly what I am also looking for - looking forward to an update! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Continuing the discussion from #3517: We would like to implement different behavior for
amp-carousel
s on different screens. Would it be possible to have thetype
property respect media queries aswell?The text was updated successfully, but these errors were encountered: