Help

Masonry is a fairly popular script. Chances are your issue has already been encountered by someone else.

Reporting bugs and issues

Report bugs and issues on GitHub.

Guidelines

The issues tracker is for bugs and issues – when Masonry doesn’t work as expected. It is not for implementation issues – when you are having trouble setting up Masonry. I am unable to personally help with implementation issues but don’t give up!

jQuery Masonry

jQuery Masonry is the original, more robust version of Masonry. Along with all the benefits of jQuery (easier DOM selection, document-ready function), it has several features missing from Vanilla Masonry:

Vanilla Masonry has the advantage of being lightweight, without any frame dependency, best suited for small applications. jQuery Masonry is better suited for larger, complex applications, when jQuery is already being used.

Additional resources

Unloaded media and overlapping

The number one issue that pops up is overlapping content. This is most likely due to unloaded images.

On window load

Masonry should be initialized on window load so that images are loaded first.

window.onload = function() {
  var wall = new Masonry( document.getElementById('container'), {
    // options...
  });
};

See Demo: Images.

Inline dimensions

Or you can specify the width and height of images inline.

<img src="img-file.jpg" width="280" height="160" />

If you’re using a PHP-based CMS, you can use the getimagesize function.

DOM ready

Instead of initializing Masonry with window.onload, you use a DOM ready script to kick things as soon as possible.

For example, with DOMReady:

DOMready( function() {
  var wall = new Masonry( element, options );
});

If you are targeting just modern browsers that support DOMContentLoaded:

window.addEventListener( 'DOMContentLoaded', function() {
  var wall = new Masonry( element, options );
}, false );