Thank you for the solution. I like it, but I would like to have always the middle occurence. So if there are 10, and we first display 1,2, 3 (i need #2 selected) , then if you click next to have 2,3,4 - but #3 selected as so on - to have always the one that's in the middle (depindeing on the navigation)
Thanks again for the support. On Fri, Sep 26, 2008 at 10:38 PM, Mauricio (Maujor) Samy Silva < [EMAIL PROTECTED]> wrote: > > HTML: > <div class="some-class"> > <p>First element</p> > <p>Second element</p> > <p>Third element</p> > </div> > > jQuery: > > $('.some-class p:eq(1)' ).css('color', 'red'); > ------------------------------------------------------------------ > jQuery pseudo-class :eq(i) targets the i-nd occurence of the obeject > selected. Counts start on zero (JavaScript based) > > Argument i can be a math expression like: ($('p').size() - 1)/2) // founds > the middle of a odd number of paragraphs > > Maujor > -----Mensagem Original----- De: "gepa" <[EMAIL PROTECTED]> > Para: "jQuery (English)" <jquery-en@googlegroups.com> > Enviada em: sexta-feira, 26 de setembro de 2008 11:44 > Assunto: [jQuery] add a new class for middle element > > > > >> Hello >> >> I really like this script. >> I was wondering , how would be possible to add a class to the middle >> element ?! >> I mean, by default there are always 3 elements, and i would like the >> middle one to be different (to add it some css style). >> >> Thanks. >> >