Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fade option not working #66

Open
nxic opened this issue May 28, 2021 · 4 comments
Open

Fade option not working #66

nxic opened this issue May 28, 2021 · 4 comments

Comments

@nxic
Copy link

nxic commented May 28, 2021

Tried to use fade option from flickity v2.2 it doesn't work.

in template

<flickity
  class="carousel"
  ref="carousel"
  :options="flickityOption"
>
  <div
    class="carousel-cell carousel-slide"
    v-for="(item, i) in slides"
    :key="`product-slide-${i}`"
  >
    <img class="" :src="item.image" alt="">
    <img class="" :src="item.desc" alt="">
  </div>
</flickity>

in script

export default {
  name: 'carousel',
  data() {
    return {
      flickityOption: {
        fade: true,
      },
      slides: [
        {
          image: 'https://picsum.photos/944/775/?image=52',
          desc: 'https://picsum.photos/944/775/?image=53',
        },
        {
          image: 'https://picsum.photos/944/775/?image=54',
          desc: 'https://picsum.photos/944/775/?image=55',
        },
        {
          image: 'https://picsum.photos/944/775/?image=56',
          desc: 'https://picsum.photos/944/775/?image=57',
        },
        {
          image: 'https://picsum.photos/944/775/?image=58',
          desc: 'https://picsum.photos/944/775/?image=59',
        },
        {
          image: 'https://picsum.photos/944/775/?image=60',
          desc: 'https://picsum.photos/944/775/?image=61',
        },
        {
          image: 'https://picsum.photos/944/775/?image=62',
          desc: 'https://picsum.photos/944/775/?image=63'
        },
      ]
    }
  },
  mounted() {
    this.$nextTick(async () => {
      await this.sleep(1500);
      const instance = this.$refs.carousel;
      instance.rerender();
      instance.reloadCells();
    });
  },
  methods: {
    next() { this.$refscarousel.next(); },
    prev() { this.$refs.carousel.previous(); },
  },
}
@nxic
Copy link
Author

nxic commented May 28, 2021

created pull request #67

@antiden
Copy link

antiden commented Jul 13, 2021

Hello,

Example for nuxtjs

  1. install yarn add flickity-fade -D
  2. connect depending in plugins/flickity.js
import Vue from 'vue'
import Flickity from 'vue-flickity'
import "flickity-fade";

Flickity.beforeDestroy = undefined;
Vue.component('flickity', Flickity)
  1. Use with option: fade: true,

Ready.

@defaye
Copy link

defaye commented Jul 20, 2021

Flickity.beforeDestroy = undefined

Why do you have the beforeDestroy set to undefined?

@antiden
Copy link

antiden commented Jul 21, 2021

To disable the hook persistently without worrying about changes from package updates or npm clean installs, the beforeDestroy method can be set to undefined when defining the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants