amirnuri
amirnuri

Reputation: 53

Masonry - auto adjusting when the height of an item changes

I am using masonry in my application. Everything worked fine except when the height of the items change (like an accordion) masonry is not adjusting the layout. What can I do to fix it?

Upvotes: 5

Views: 6017

Answers (2)

Arnaud Jeannin
Arnaud Jeannin

Reputation: 49

$grid.on( 'shown.bs.collapse hidden.bs.collapse' , function() {
    $grid.masonry();
});

Upvotes: 0

Markus Jarderot
Markus Jarderot

Reputation: 89171

Whenever the items are resized, you need to tell masonary to re-layout everything:

$('.ui-accordion').bind('accordionchange', function(event, ui) {
    $('#container').masonry();
});

Upvotes: 6

Related Questions