admin管理员组

文章数量:1393920

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?

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?

Share Improve this question asked Oct 31, 2012 at 10:26 amirnuriamirnuri 531 silver badge4 bronze badges 2
  • 1 Could you show some code? What have you tried so far? – user254875486 Commented Oct 31, 2012 at 10:46
  • Can you provide more code from your app? – VMAtm Commented Oct 31, 2012 at 10:46
Add a ment  | 

2 Answers 2

Reset to default 6

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

$('.ui-accordion').bind('accordionchange', function(event, ui) {
    $('#container').masonry();
});
$grid.on( 'shown.bs.collapse hidden.bs.collapse' , function() {
    $grid.masonry();
});

本文标签: javascriptMasonryauto adjusting when the height of an item changesStack Overflow