bramkragten / swipe-card

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

Link to "page" within swiper #2

Open raffertyp1 opened 5 years ago

raffertyp1 commented 5 years ago

Is it possible to add a url/location hash on each card within the swiper, so that you can navigate to predefined location in the swiper container?

I have a set of entity buttons that display the temperatures in my house. Below that, I have a swiper container with the graphs of the temperature history for each of those room's. I'd like to use the navigate action within the button to display the associated temperature graph in the swiper.

matt8707 commented 4 years ago

I just tried this out as I would like to automate between swipe cards. It doesn't work...

I added <div class="swiper-slide" data-hash="slide1">Slide 1</div> to swipe-card.js

<div class="swiper-wrapper">
${this._cards}
<div class="swiper-slide" data-hash="slide1">Slide 1</div>
</div>

Then added the hashNavigation parameter

- cards:
...
parameters:
  hashNavigation:
    watchState: true
type: 'custom:swipe-card'

And it works if you type in #slide1 in the adress bar. But it doesn't work using the navigate action...

tap_action: 
  action: navigate
  navigation_path: '#slide1'

The url changes but not the swipe card because the navigate action is not a "html link"...