ciampo / macro-carousel

Carousel as a Vanilla Web Component.
https://ciampo.github.io/macro-carousel/demo/
MIT License
77 stars 6 forks source link

[layout] Allow centered slides #28

Open ciampo opened 6 years ago

ciampo commented 6 years ago

The selected slide would be in the middle of the view. This would require a few changes to how the carousel works.

equinusocio commented 6 years ago

Can the new CSS scroll snap control may helps?

ciampo commented 6 years ago

It could, but it may also require deep refactoring. Also, the new version of the spec is not supported by many browsers, so it would require a fallback solution

equinusocio commented 5 years ago

Btw this can be done easily by composing in the light dom. Users can define slider with a single centered content. Something like this:

<style>
div {
  display: flex; /* or grid */
  justify-content: center;
}
</style>
<macro-carousel>
  <div> [Centered Content] </div>
  <div> [Centered Content] [Centered Content] </div>
  <div> [Centered Content] </div>
</macro-carousel>
ciampo commented 5 years ago

By "centered slides" I meant something like this (hope it helps explaining the idea):

Screenshot 2019-04-22 at 1 42 10 PM