I am not good at jQuery so I am not sure if my assumptions are corrent.
I am using the isotope plugin, with which I want to insert elements one by one (and not everything at once) with a slight delay so it will also look like it (for the human eye)
to insert an item with isotope I use
$('#container').isotope( 'insert', $item);
so in order to insert one-by-one I am doing
$("#items_are_here").find('.item').each(function( index ) {
setTimeout(function() {
$('#container').isotope( 'insert', $(this));
},3000);
});
This however seems that the browser waits for something, and then 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 over-complicating it?
here is fiddle. In it, there are 2 buttosn - insert all - which finds all .item
and inserts them. And insert one-by-one which does the proposed way with delay. As you can see, there is no delay.