Reputation: 14926
I have a jQuery post that replaces a div with updated products. The grid is formatted with isotope but I can't figure out how to make it re-format the grid after update.
$.post(url, function(data) {
$('#product_list').first().replaceWith(data.products);
}).always($('#product_list').isotope({
itemSelector: '.product-thumb-info-list'
}));
If I run the isotope()
from console it will re-order the grid nicely so I guess it is firing too early.
How can I get it to apply to the grid immediately after the post function replaces the div?
Upvotes: 0
Views: 101
Reputation: 13699
Can you change on how you handle your always
method to this instead:
$.post(url, function(data) {
$('#product_list').first().replaceWith(data.products);
}).always(function() {
$('#product_list').isotope({
itemSelector: '.product-thumb-info-list'
})
});
Upvotes: 1