0

instafeed.js中,我sortBy可以通过most-liked或标记图片most-recent。这些选项是相互排斥的。我试图找到一个中间立场来做这两件事。我想排序most-recent,然后显示那些有likes > x amount. 如何在 instafeed.js 中实现这一点?

var feed = new Instafeed({
  target: 'instafeed',
  get: 'tagged',
  tagName: 'dog',
  limit: '10',
  sortBy: 'most-recent',
  resolution: 'standard_resolution',
  clientId: 'xxxxx', 
  template:'<div class="tile"><div class="text"><b>{{likes}} &hearts; </b>{{model.user.full_name}}</div><img class="item" src="{{image}}"></div>',
  filter: function(image) {
    //filter for recent images with most like
  }
});
4

1 回答 1

2

根据此https://github.com/stevenschobert/instafeed.js/issues/21 ,过滤器函数中的image参数具有属性likes。所以你应该能够做类似的事情

filter: function(image) {
  return image.likes.count >= minAmount;
}
于 2014-11-15T16:58:19.117 回答