Instafeed.js - Sortby most-liked when 60+ images

时间:2015-06-25 09:56:57

标签: javascript instafeedjs

I am using instafeed.js to display Instagram images on my homepage.

I got 1000+ images I would like to sortby most-liked and load 60 at a time.

When I use "sortBy: most-liked" it looks like instafeed.js loads the 60 recent images and then sort these 60 by most-liked. When I load the next 60 images I get the next 60 recent images and these sorted by most liked.

It looks like it is not posible to sort all 1000+ images by most-liked. And then load 60 at a time?

Is this how instafeed.js works? Or is it a bug?

 <script type="text/javascript">
  var feed = new Instafeed({
   sortBy: 'most-liked',
    get: 'tagged',
   tagName: 'awesome',
   clientId: 'YOUR_CLIENT_ID'
  });
 feed.run();
</script>

Kind regards

1 个答案:

答案 0 :(得分:0)

据我所知,目前instafeed支持最多加载60张图像。但是有一种方法可以加载更多图像并按照您的要求显示它们,并且它需要一些代码工作。

首先需要按照以下步骤操作;

  1. 调用feed.next()存储数据,直到达到1000张图像。 - 来自&#34;&#34;之后#34;不安全的回调。
  2. 使用相同的数量对图像进行排序 - 需要具有我们自己的比较功能。
  3. 创建模板以显示图像。
  4. 最后切片数据(1000个中的60个)并显示在Div。
  5. &#13;
    &#13;
    <script src="http://sriajith.info/wp-content/uploads/2015/05/instafeed.min_.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <div class="instaFeedButton">
    <button id="next-feeds" class="btn-feed">Next</button>
    </div>
    <br/> <br/>                
    <div id="instafeed" class="instagramFeed"></div>
    &#13;
    {{1}}
    &#13;
    &#13;
    &#13;

    如果您想添加分页,可以在here

    找到一些信息