metafizzy / packery

:bento: Gapless, draggable grid layouts
https://packery.metafizzy.co
4.14k stars 316 forks source link

layoutComplete stopped triggering when items get hidden #124

Open miksh7 opened 10 years ago

miksh7 commented 10 years ago

The a few items get hidden by style="display:none" the layoutComplete event stopped triggering. In some scenario it's impossible to use Packery.remove as the item needs to be visible later.

See the updated layoutComplete example http://codepen.io/anon/pen/yEkIF where the remove method was replaced by // make hidden event.target.style.display = 'none'; //classie.toggle( event.target, 'gigante' );

After hiding 2-4 items the notification doesn't appear.

maxkirchoff commented 10 years ago

I've had this same issue and I believe it is because changing the display attribute interrupts the css3 transitions. When css transitions are interrupted, the transitionend event does not fire. Packery waits to fire the layoutComplete until all transitionend events have fired. Thus, when you interrupt the css transitions, layoutComplete never fires.