Skip to content

Commit 9d3c8e2

Browse files
update readme
1 parent acaf0f1 commit 9d3c8e2

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

README.md

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,14 @@ The only thing you'll need to get going is a valid __client id__ from Instagram'
8787
given the image data as an argument, and expects the function to return a boolean. See the example
8888
below for more information.
8989

90-
__Example Filter:__
90+
__Example Filter (get username + tagged):__
9191

9292
```js
9393
var feed = new Instafeed({
94+
get: 'user',
95+
userId: USER_ID,
9496
filter: function(image) {
95-
// only display images with at least 10 likes
96-
return image.likes.count >= 10;
97+
return image.tags.indexOf('TAG_NAME') >= 0;
9798
}
9899
});
99100
feed.run();
@@ -139,29 +140,24 @@ Under the hood, this uses the _pagination_ data from the API. Additionall, there
139140
Together these options can be used to create a "Load More" button:
140141

141142
```js
142-
function checkLoadMore() {
143-
// if there are no more results, disable the load more button
144-
if (!this.hasNext()) {
145-
loadButton.setAttribute('disabled', 'disabled');
146-
}
147-
};
143+
// grab out load more button
144+
var loadButton = document.getElementById('load-more'),
145+
146+
feed = new Instafeed({
147+
// every time we load more, run this function
148+
after: function() {
149+
// disable button if no more results to load
150+
if (!this.hasNext()) {
151+
loadButton.setAttribute('disabled', 'disabled');
152+
}
153+
},
154+
});
148155

149-
function handleLoadClick() {
150-
// load more!
156+
// bind the load more button
157+
loadButton.addEventListener('click', function() {
151158
feed.next();
152-
};
153-
154-
// create our Instafeed instance
155-
var feed = new Instafeed({
156-
success: checkLoadMore
157159
});
158160

159-
// grab out load more button
160-
var loadButton = document.getElementById('load-more');
161-
162-
// bind out click event
163-
loadButton.addEventListener('click', handleLoadClick);
164-
165161
// run our feed!
166162
feed.run();
167163
```

0 commit comments

Comments
 (0)