Answer the question
In order to leave comments, you need to log in
mosonry() not working for new photos, how to fix?
I use the mosonry miniframework, when it starts it detects all the photos in the tag and works only with them. If, for example, another photo is added via ajax, then this photo will not be used even if mosonry() is run. I need that by adding photos they were built taking into account the mosonry scheme. Can you suggest another framework?
Answer the question
In order to leave comments, you need to log in
Masonry has a special method for this:
$('.append-button').on( 'click', function() {
// create new item elements
var $items = $('<div class="grid-item">...</div>');
// append items to grid
$grid.append( $items )
// add and lay out newly appended items
.masonry( 'appended', $items );
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question