bramkragten / swipe-card

Card that allows you to swipe throught multiple cards for Home Assistant Lovelace
245 stars 36 forks source link

Sync two swipers like in “Thumbs Gallery” example #25

Open schmurtzm opened 3 years ago

schmurtzm commented 3 years ago

Awesome card, thank you. Can we make a “Thumbs Gallery” with it ? The example of “Thumbs Gallery” from the swiper website.

I tried to make a simple example and I’m not sure that what I’m trying to do is possible… In fact the “Thumbs” component is a way to sync two swipers so the main swiper has another instance of a swiper in parameter 🧐 :

type: vertical-stack
cards:
  - type: 'custom:swipe-card'
    title: MainSwiper
    parameters:
      navigation: null
      keyboard:
        enabled: true
        onlyInViewport: true
      Thumbs:
        swiper: SubSwiper
        autoScrollOffset: 1
    cards:
      - type: sensor
        entity: sensor.temp_0
      - type: sensor
        entity: sensor.temp_1
      - type: sensor
        entity: sensor.temp_2
      - type: sensor
        entity: sensor.temp_3
  - type: 'custom:swipe-card'
    title: SubSwiper
    card_width: 185px
    parameters:
      freeMode: true
      grabCursor: true
      spaceBetween: 10
      watchSlidesVisibility: true
      watchSlidesProgress: true
      slidesPerView: 2
    cards:
      - type: sensor
        entity: sensor.temp_0
      - type: sensor
        entity: sensor.temp_1
      - type: sensor
        entity: sensor.temp_2
      - type: sensor
        entity: sensor.temp_3

So three questions about the code example above (which doesn’t work) :

  1. Is vertical stack the right way to do it?
  2. Can I instantiate my sub swiper in the main swiper ?
  3. So can I achieve that ? 😋

Thank you.

cbass27 commented 11 months ago

I know your question was a few years ago but we're you ever able to get the thumbs functionality working? I'm looking to do something similar but haven't found any examples on how to accomplish this.

schmurtzm commented 11 months ago

I don't think so. I have also posted my question here but not sure that the anwser helps.

cbass27 commented 11 months ago

Thanks for your reply. Yeah that solution is something I've been thinking about doing but if this card (or any other) can do it, I'd prefer to use it. But it looks like I may just have to go that route. Thanks again.