metafizzy / flickity-imagesloaded

enables imagesLoaded option for Flickity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plugin fires 'cellSelect' event for every image in gallery

tcrosen opened this issue · comments

Hi David, thanks for the great plugin you have created.

It seems when using imagesloaded: true, the cellSelect event is fired once for every image in the gallery when the plugin loads. Here is a Codepen demo showing the problem in action (you will need to view the console).

Digging around in the code I found these lines so I enabled freeScroll and sure enough the issue goes away.

I would have submit a PR but I'm not sure whether this is a bug or intended behaviour. It seems counterintuitive to be firing before the plugin is loaded. Unfortunately I can't enable freeScroll and use cellSelect to fire off a number of different actions so for my use case this is a huge problem. My workaround in the meantime is to use the settle event instead, but cellSelect would be preferred for both semantic reasons and because it fires immediately whereas settle is delayed by animation.

Thanks for your time.

Thanks for reporting this bug. This is intended behavior. I've recently addressed it in metafizzy/flickity#179. Let's keep this discussion there.