I am creating a layout using the 960 grid system and have div items that are displayed automatically. I need to be able to apply an 'alpha' class to the first and 'omega' class to the fourth e.g. div-alpha,div,div,div-omega,div-alpha,div,div,div-omega.
Using the code below it is applying the alpha class to all of the divs :
var n = $("div.item").length;
$('div .item').filter(function(index) {
return n % 5 == 1;
}).addClass('alpha');
$('div .item').filter(function(index) {
return n % 5 == 5;
}).addClass('omega');
How can I achieve this? Many thanks in advance.