I am not very good at jQuery, so I'm not sure if my assumptions are root.
I use an isotope plugin with which I want to insert elements one after the other (and not all at once) with a slight delay so that it also looks like (for the human eye)
to insert the isotope element that I use
$('#container').isotope( 'insert', $item);
so in order to insert one by one, I do
$("#items_are_here").find('.item').each(function( index ) { setTimeout(function() { $('#container').isotope( 'insert', $(this)); },3000); });
However, it looks like the browser is waiting for something, and then it displays them all at once
If i do
setTimeout(function() { $("#items_are_here").find('.item').each(function( index ) { $('#container').isotope( 'insert', $(this)); }); },3000);
everything works, but not one by one.
Is this the right way to do this? or am I complicating this too much?
here is fiddle . It has 2 buttosn - insert all - which finds all .item and inserts them. And insert one by one, which does the proposed method with a delay. As you can see, there is no delay.
source share