How to get Isotope working with dynamic DOM nodes?

烂漫一生 提交于 2019-12-04 13:58:02

I stumbled upon the same issue some time ago, and I resolve it in this way, if you want to keep Isotope's animation between operations:

In your remove function instead of $container.html(''); write:

var elToRemove = $container.data('isotope').$filteredAtoms;
$container.isotope('remove',elToRemove);

And in your create function, instead of $container.html(list);:

$container.isotope('insert',$(list));

Otherwise if you don't need animation between operations you could keep your functions as they are and just re-initialize Isotope in you create function before calling shuffle.

Working fiddle: http://jsfiddle.net/T8aSQ/7/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!