How to use the swiper/dist/js/swiper.esm.js.Swiper function in swiper

To help you get started, we’ve selected a few swiper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github davidgaroro / vuetify-swipeout / src / components / SwipeoutItem.vue View on Github external
mounted () {
    const self = this
    const el = '#' + this.id
    const direction = this.direction

    // Initialize Swiper
    const swiper = new Swiper(el, {
      initialSlide: this.direction === 'left' ? 0 : 1,
      resistanceRatio: 0,
      speed: 150
    })

    // Event will be fired after transition
    swiper.on('transitionEnd', function () {
      const activeIndex = this.activeIndex
      if ((direction === 'right' && activeIndex === 0) || (direction === 'left' && activeIndex === 1)) {
        self.$emit('transitionEnd')
        // Destroy slider instance and detach all events listeners
        this.destroy()
      }
    })
  }
}
github pedaling / class101-ui / src / components / Swiper / index.tsx View on Github external
useEffect(() => {
    if (containerId) {
      swiperRef.current = new OriginalSwiper(`#${containerId}`, swiperOptionsRef.current);
    }
  }, [containerId, swiperRef, swiperOptionsRef]);