title: javascript - instafeed.js - Limit with filters
body: <p>I'm using instafeed.js to load some photos from Instagram and I have a little function that load the feed setting a specific tag as filter. Like this:</p>
  
  <pre><code>function generateFeed(category){
     var feed = new Instafeed({
            target: category+'Feed',
            get: 'user',
            userId: 'USERID',
            accessToken: 'TOKEN',
            sortBy: 'most-recent',
            template: '&lt;div id="insta-card" class="animated fadeIn col-lg-4 col-md-4 col-sm-4 col-xs-4"&gt;&lt;a class="fancybox-thumb-'+category+'" rel="fancybox-thumb" href="{{image}}"&gt;&lt;img class="insta-img" src="{{image}}"&gt;&lt;/a&gt;&lt;div class="insta-infos"&gt;&lt;p&gt;{{caption}}&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;',
            limit: '12',
            resolution: 'standard_resolution',
            filter: function(image) {
                return image.tags &amp;&amp; image.tags.indexOf(category) &gt;= 0;
            },
            after: function(){
              if (!this.hasNext()) {
                  $('.load-button').hide();
              }else{
                  $('.load-button').show();
              }
            }
          });
  feed.run();
  
  $('.load-button').on('click',function(){
          feed.next();
  });
  }
  </code></pre>
  
  <p>Everything works well, but it seems like the <strong>limit</strong> (in this case 12) isn't the limit of loaded photos, but the limit of photos to fetch searching the tag.</p>
  
  <p>And if in this limit there are no photos with that tag, the feed would be empty also if this photos exists and have that tag!</p>
  
  <p>Is there a way to handle this? To set limit to max (60) when searching by filter?</p>
  
  <p>It would be easy if limit can be passed from the <em>feed.next()</em> function, but I haven't found nothing that works. </p>
  
  <p>Can anyone help me?</p>
  
  <p>Thanks.</p>