Skip to content

Instantly share code, notes, and snippets.

@stevenschobert
Created December 18, 2014 18:32
Show Gist options
  • Save stevenschobert/8530a0c556217da00e2d to your computer and use it in GitHub Desktop.
Save stevenschobert/8530a0c556217da00e2d to your computer and use it in GitHub Desktop.
Instafeed.js - Wrap every 4th item with a tag
var count = 0;
var feed = new Instafeed({
filter: function(image) {
count += 1;
if (count % 4 === 0) {
image.customTagOpen = '<div>';
image.customTagClose = '</div>';
} else {
image.customTagOpen = '';
image.customTagClose = '';
}
return true;
},
template: '{{model.customTagOpen}}<img src="{{image}} />{{model.customTagClose}}';
});
feed.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment