metafizzy / flickity

:leaves: Touch, responsive, flickable carousels
https://flickity.metafizzy.co
7.53k stars 602 forks source link

Is it possible to use with jQuery Lazy? #912

Closed pflind closed 5 years ago

pflind commented 5 years ago

I know that Flickity has it's own lazy load method but can it be used with jQuery Lazy?

The specific problem is how to update the height of the Flickity carousel items once the jQuery Lazy images has loaded.

Something like this doesn't work:

$('.carousel').flickity({
  imagesLoaded: true,
  on: {
    ready: function() {
      $(this).flickity('resize'); // resize carousel
    },
    change: function( index ) {
      $(this).flickity('resize'); // resize carousel
    }
  }
});

This returns an error instead of resizing the carousel flickity not initialized. Cannot call methods, i.e. $().flickity("resize")

pflind commented 5 years ago

Never mind :) this can be deleted.