Я нашел решение, которое отлично работает для меня. каждые полсекунды перезагружается макет экземпляра каменной кладки.
//initialization of a masonry object:
var msnry = new Masonry("#container",{
itemSelector: '#post',
gutter: 15
});
//thread that makes the magic happens:
setInterval(function(){
msnry.reloadItems();
msnry.layout();
},500);
Таким образом, вы можете добавлять вещи, используя ajax, и вуаля, есть макет кладки.
Ok, I figured it out.
The script above DOES work.
What was happening is I had a series of include_once files, and one of them had a blank line causing the issue.
Not sure if this is the real answer, but I think you intended
header('Content-Type: ' . $mimeType);
to be
header('Content-Type: ' . $mimeTypes[$mimeType]);