drewjbartlett / vue-flickity

A Vue Slider / Carousel Component for Flickity.js
http://drewjbartlett.com/demos/vue-flickity/
374 stars 55 forks source link

Example of asNavFor #36

Closed pwnz22 closed 6 years ago

pwnz22 commented 6 years ago

Hello guys!

Can someone provide an example of using asNavFor option? Thanks!

josefarrugia commented 6 years ago

I too am stuck on this. Any updates?

pwnz22 commented 6 years ago

You need to npm install flickity-as-nav-for and import it

npm install flickity-as-nav-for
import 'flickity-as-nav-for'
mortensassi commented 5 years ago

How did you get it to work? Imported the plugin and set the option but it doesn't do anything

mrKorg commented 5 years ago

Hi, I have the same problem

danimalweb commented 5 years ago

I'd love to see an example of this too.

diegood commented 4 years ago

Example html:

<template>
  <div>
      <Flickity  ref="main" :options="mainImgOtions" class="carousel-main" style="height:20em">
            <b-card  v-for="(image, index) in product.images" :key="index" class="carousel-cel h-100 w-100">
              <b-img  :src="image" alt="Left image"></b-img>
            </b-card>
      </Flickity>
      <Flickity  ref="nav" :options="navImgOtions" class="carousel-nav" style="height:5em">
            <b-card  v-for="(image, index) in product.images" :key="index" class="carousel-cel h-100 w-25">
              <b-img  :src="image" alt="Left image"></b-img>
            </b-card>
      </Flickity>
  </div>
</template>

Example Script:

import Flickity from 'vue-flickity';
import 'flickity-as-nav-for'
export default {
  name: "DetailProductImgComponent",
  components: { Flickity },
  data() {
    return {
      imgVisible: 0,
      mainImgOtions: {
        initialIndex: 0,
        prevNextButtons: false,
        pageDots: false,
        wrapAround: false
      },
      navImgOtions: {
        asNavFor: '.carousel-main',
        freeScroll: false,
        contain: true,
        prevNextButtons: false,
        pageDots: false,
        wrapAround: true
      }
    }
  },
};