Flickity done callback?

1.3k views Asked by At

I'm using flickity with react. I'm instantiating it like this:

this.flky = new Flickity('.carousel', flickityOptions)

Flickity applies position: absolute to images and then uses it to measure some sizes, I need to change this position to static after flickity is done for my responsive css to work. Does flickity have a callback or can I know it some other way?

1

There are 1 answers

0
Isaac Gregson On BEST ANSWER

This is currently an open issue and feature request: https://github.com/metafizzy/flickity/issues/493

In that GitHub thread this temporary solution is given for adding a "ready" event to Flickity (give by Flickity's creator):

var activate = Flickity.prototype.activate;
Flickity.prototype.activate = function() {
  if ( this.isActive ) {
    return;
  }
  activate.apply( this, arguments );
  this.dispatchEvent('ready');
};