Dynamically Adding HTML Elements to a Masonry Container
The official Masonry documentation doesn’t really cover this well, and all the external examples I found seem to be outdated. I got it working in v3.1.2 via trial and error. Basically, you just have to reload all the items before laying them out. Makes sense once you understand it… var mediaItemContainer = $( '#container' ); mediaItemContainer.masonry( […]