css nth-child(2n+1) repaint css after filtering out list items

Posted by Michael on Stack Overflow See other posts from Stack Overflow or by Michael
Published on 2012-07-26T20:50:35Z Indexed on 2012/10/26 5:02 UTC
Read the original article Hit count: 811

I have a list of 20+ items. The background-color changes using the :nth-child(2n+1) selector. (ie. even item black, odd item white). When I click a button to filter out specific items using the jQuery Isotope plugin it adds a .isotope-hidden class to the items I want to filter out, which changes the position of the list item to 0,0 and opacity to 0.

When this happens the remaining items are left with the original black/white background-colors, which are now no longer in order.

Does anyone know a way to "repaint' the css using the :nth-child(2n+1) selector on the items that do not contain the .isotope-hidden class.

I tried

#element tr:not(.isotope-hidden):nth-child(2n+1)

with no avail.

Any help would be appreciated. Thank you.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about css