title: Masonry plugin returning error when used with Infinite Scroll in tumblr
body: <p>I know alot has been written about this, but I feel I am close to solving the issue. </p>
  
  <p>I am trying to use a theme which has masonry installed, but now the client is asking for infinite scroll and this is causing me issues. </p>
  
  <p>Initially I was seeing errors in the console for both the masonry and infinite scroll plugins, now at least I am only seeing a masonry error. And it does look as though the infinite scroll function is calling subsequent pages of posts, it's just that Masonry is struggling to append them to the page in the right layout. </p>
  
  <p>I think it is something to do with my callback function, but worried I may also need to call an imagesLoaded function (this plugin is also called via the theme). </p>
  
  <p>I have a copy of the current theme here: <a href="http://kod-temp.tumblr.com/" rel="nofollow">http://kod-temp.tumblr.com/</a></p>
  
  <p>The inline script looks like this: </p>
  
  <pre><code>var $wall = $('#posts');
  
  $(window).load(function () {
  // Grid
      $wall.masonry({
      columnWidth: 84, 
      itemSelector: '.post:visible'
  });
  
  // infinite scroll
  $('#posts').infinitescroll({
      navSelector  : ".pagination", // selector for the paged navigation (it will be hidden)
      nextSelector : ".pagination a:first", // selector for the NEXT link (to page 2)
      itemSelector : "#posts .post" // selector for all items you'll retrieve
  },
  // trigger Masonry as a callback
  function( newElements ) {
      var $newElems = $( newElements );
      $wall.masonry( 'appended', $newElems );
      }
  );
  </code></pre>
  
  <p>The markup follows a simple block like this:</p>
  
  <pre><code>&lt;div id="posts"&gt;
      &lt;article class="post"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The error is:</p>
  
  <pre><code> Uncaught TypeError: undefined is not a function 
   masonry.js:10
  </code></pre>
  
  <p>(<a href="http://static.tumblr.com/qlf79cn/tGeleg9g0/masonry.js" rel="nofollow">http://static.tumblr.com/qlf79cn/tGeleg9g0/masonry.js</a>)</p>