metafizzy / flickity

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

cellSelect + settle are fired when manipulating cells #142

Closed pseidemann closed 8 years ago

pseidemann commented 9 years ago

hello,

when I prepend/append/insert/remove cells, cellSelect + settle are fired, which I don't expect.

this bug makes it impossible to add cells dynamically in the cellSelect/settle event listener (which was fired by a previous select() call). the listener will be called twice.

test case: http://codepen.io/anon/pen/Kpgzqg

brandondove commented 9 years ago

+1 I'm getting this too.

desandro commented 8 years ago

Thanks for reporting this issue. Yes, this is how Flickity operates. After changing the cells, Flickity triggers select so it can properly reposition cells, and have a cell selected. I'd say it's a feature, not a bug :grin:.

It's a been 10 months and this issue has been mostly quiet. Closing. Thanks again for chiming in! :strawberry:

jsbase commented 4 years ago

that's pretty uncool, because i can call the reposition method by myself. maybe u could make "append" returning a promise like: append(cells).then( /* do whatever u want*/ ) ) this way u can disable a single event by flkty.off('settle', mySettleCallback) for example and enable this event after append finished the rendering process