desandro / masonry

:love_hotel: Cascading grid layout plugin
https://masonry.desandro.com
16.27k stars 2.11k forks source link

Overlapping images when dynamically adding a new Image #1157

Open hn1 opened 3 years ago

hn1 commented 3 years ago

We are using the Masonry.js library but are having problems in that when we add a new image dynamically, the layout does not adjsut correctly and the new image is hidden behind existing images.

This is our Code:

function InitMasonry() {
    $allposts.imagesLoaded(function () {
        $allposts.masonry({
            // options
            itemSelector: '.postItem',
            columnWidth: 250,
            fitWidth: true
        });
    });
}

and after the image is added we call:

$allposts.prepend($item)
 $allposts.masonry('prepended', $item);
 $allposts.masonry('layout');

Greatly appreciate any assistance.

hn1 commented 3 years ago

Considering people have to pay for the privilage of using this, it would be nice if the developer could be bothered to answer the questions!

And if this is not being maintained any longer, please advise.