I am trying to style a group of divs in such a way that every set of eight elements will have the same left positioning. Rather than just styling every eighth element individually, I want to apply the styling to groups of eight elements at once. However, my attempts using CSS and jQuery are only affecting every eighth element, which is not the desired outcome.
var cells = $('.board-cells'),
cellUnit = 70,
startPos = -35;
var left;
for(j=0; j<8; j++){
left = startPos+(cellUnit*j+1) + 'px';
}
for(i=0; i<cells.length; i+=8){
var cellItem = $('.board-cells:nth-of-type('+i+'n+0)');
cellItem.css('left', left);
}