Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

no such method 'reload' for masonry instance

Good staff is as follows, when the page finishes loading, masonry failure and I do not know why, but I found a method that is masonry.reload.

This method works sometimes, I wonder why.

var $container = $('.container');
$container.masonry({    
        itemSelector: '.item',
        columnWidth: 25

}).imagesLoaded(function(){
    $container.masonry('reload');   
});
like image 499
Silvio Luis Avatar asked Feb 05 '14 00:02

Silvio Luis


2 Answers

In the newer versions of masonry you use "reloadItems" instead of "reload". I ran across a tip on this thread that pointed me in the right direction.

.imagesLoaded(function(){
      $container.masonry('reloadItems');   
      $container.masonry('layout');
});
like image 164
Developer Dave Avatar answered Oct 18 '22 17:10

Developer Dave


Try the following:

<script src="https://unpkg.com/imagesloaded@4/imagesloaded.pkgd.min.js"></script>

var $grids = $('.masonrow').masonry({
    itemSelector : '.masonryme' 
});

$("#Box").append(e).imagesLoaded(function() {
    $grids.masonry('reloadItems');   
    $grids.masonry('layout');
});
like image 40
Rinki Avatar answered Oct 18 '22 17:10

Rinki