Skip to content

Wrong swiper instance example #7

@EinLinuus

Description

@EinLinuus

Hi,

the "Swiper instance" example didn't work for me:

<script>
  import { Swiper, SwiperSlide } from 'svelte-swiper';
  let mySwiper;

  function slideTo () {
    mySwiper.slideTo(5);
  }
</script>

<button on:click={slideTo}>slideTo</button>

<Swiper bind:swiper={mySwiper}>
   <!-- ... -->
</Swiper>

When I copied the example and tried it, mySwiper was a function that returned the instance - so I changed the code to mySwiper().slideTo(5) and it worked.

It would be great if the example is corrected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions