Masonry
  
    Show archive.org snapshot
  
 is a famous library to dynamically arrange a grid of items that have different aspect ratio, like horizontal and vertical images.
  Colcade
  
    Show archive.org snapshot
  
 is an alternative masonry-layouting library, developed by the same developer, but with a more modern approach.
It is said to have better performance while being smaller and having no dependencies. It automagically detects jQuery and defines a jQuery initializer, if present.
However, it offers 
  a few less features
  
    Show archive.org snapshot
  
. If you require column-spanning items, don't use Colcade. If you want item transitions, you need to define them yourself.
Check out the GitHub projects and linked examples.
Full disclosure: I have not used Colcade yet, but it looks very promising. It has no tests, though. I'd also love to see a migration guide for users coming from Masonry.