我正在使用instafeed.js
来获取最新的Instagram帖子,我需要为每个列表项生成id
。我怎么能这样做?
JS:
var feed = new Instafeed({
clientId: '<id>', //enter client id here
limit: 5,
sortBy: 'most-liked',
//<div class="likes">♥ {{likes}}</div> ************************* likes count
template: '<li><a href="{{link}}" target="_blank"><img class="img-responsive img-circle center-block" src="{{image}}"></li>'
});
feed.run();
HTML:
<ul id="instafeed"></ul>
答案 0 :(得分:0)
答案 1 :(得分:0)
您可以使用{{id}}
关键字
var feed = new Instafeed({
clientId: '<id>', //enter client id here
limit: 5,
sortBy: 'most-liked',
template: '<li id="{{id}}"><a href="{{link}}" target="_blank"><img class="img-responsive img-circle center-block" src="{{image}}"></li>'
});
feed.run();
<script src="https://cdn.imnjb.me/libs/instafeed.js/1.3.2/instafeed.js"></script>
<ul id="instafeed"></ul>