Skip to content
Advertisement

Masonary image not positioning correctly on ajax call

I am using https://masonry.desandro.com/ v4.2.2 and the minimal code looks like:

JavaScript

And, I have initalized it as :

JavaScript

Upto this point its fine, now on click load more, I am making an ajax call and on success it is returning html as:

JavaScript

and my ajax success:

JavaScript

But, with this code the image are not aligned to correct position and is displayed as:

Wrong stacking image

This is what it looked initially:

Initially

What it should look like:

enter image description here

Update:

I have tried with:

JavaScript

I have tried with above code, it is adding the new content but it is not increasing the height of current container and instead overlapping over next container. With this the load data button is covered by the data so I can’t make another request.

Advertisement

Answer

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement