title: jquery masonry images are overlapping until a page resize is done
body: <p>I've found this template that demonstrates the issue I'm having with <a href="http://masonry.desandro.com/" rel="nofollow noreferrer">jquery masonry</a> and image layout. Take a look at this twitter bootstrap template <a href="http://wbpreview.com/previews/WB0F35928/gallery.html" rel="nofollow noreferrer">page</a>: </p>
  
  <p>The very first time the page is loaded all the images are stacked on each other until a page refresh or re-size is done.  The images are then displayed correctly.</p>
  
  <p>Here is my HTML and jQuery that has the same problem:</p>
  
  <h2>HTML</h2>
  
  <pre><code>&lt;div class="gallery-masonry masonry" style="position: relative; min-height:100px; height: auto;"&gt;
    &lt;div id="loading"&gt;Loading ...&lt;/div&gt;                            
  &lt;/div&gt;
  </code></pre>
  
  <h2>jQuery</h2>
  
  <pre><code>$.post("functions/photo_functions.php", { f: 'getallphotos'}, function(data) {
  
    $('#loading').hide();
  
      if(data) {  
        $.each(data.images, function(i, image) {
          var img_block = '&lt;div class="item masonry-brick" style="position: absolute; top: 0px; left: 0px;"&gt;' +
          '&lt;a href="#" class="thumbnail"&gt;&lt;img src="'+image.url+'" alt=""&gt;&lt;/a&gt;' +
          '&lt;div class="actions"&gt;' +
          '&lt;a title="" href="#" class="tip-top" data-original-title="Edit"&gt;&lt;i class="icon-pencil icon-white"&gt;&lt;/i&gt;&lt;/a&gt;' +
          '&lt;a title="" href="#" class="tip-top" data-original-title="Remove"&gt;&lt;i class="icon-remove icon-white"&gt;&lt;/i&gt;&lt;/a&gt;' +
          '&lt;/div&gt;' +
          '&lt;/div&gt;';
  
          $(".gallery-masonry").append(img_block);
            });
  
          $('.gallery-masonry').masonry({
            itemSelector: '.item',
            isAnimated: true,
            isFitWidth: true
          });             
        }
  
      }, "json");
  </code></pre>
  
  <p>Any idea why this is happening and how might I fix it?</p>