My masonry transitions works well on first load.
However, when I make an AJAX call to retrieve new items, the old elements remains the same position, but the new items are aligned vertically from top to bottom.
It works well on the first load.
After an AJAX call, the new items are aligned vertically
my index.html.haml
.masonry-container.transitions-enabled
= render 'masonry_container', items: @items
_masonry_container.html.haml
- items.each do |item|
#i guess the code here is not important as i generate each image box succesfully
index.js.erb
$(".masonry-container").imagesLoaded(function(){
$(".masonry-container").append("<%= j render 'masonry_container',
items: @items %>").masonry('appended', "<%= j render
'masonry_container', items: @items %>", 'reloadItems');
});
Would appreciate if you could offer some helps.