Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding even / odd class names to list items

  • Loading branch information...
commit f70332b95079c2f436708aadbade484b1ab606dd 1 parent 4728120
@joestelmach joestelmach authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  src/js/collection_view.js
View
3  src/js/collection_view.js
@@ -100,9 +100,10 @@
_updateClassNames : function() {
var children = this.collectionEl.childNodes;
if(children.length > 0) {
- _(children).each(function(child) {
+ _(children).each(function(child, index) {
$(child).removeClass('first');
$(child).removeClass('last');
+ $(child).addClass(index % 2 === 0 ? 'even' : 'odd');
});
$(children[0]).addClass('first');
$(children[children.length - 1]).addClass('last');
Please sign in to comment.
Something went wrong with that request. Please try again.