Created
December 18, 2014 18:32
-
-
Save stevenschobert/8530a0c556217da00e2d to your computer and use it in GitHub Desktop.
Instafeed.js - Wrap every 4th item with a tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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