How to reinforce pseudo css rules

Posted by danwoods on Stack Overflow See other posts from Stack Overflow or by danwoods
Published on 2010-05-26T20:45:47Z Indexed on 2010/05/26 20:51 UTC
Read the original article Hit count: 402

Filed under:
|
|

Is there anyway to reinforce pseudo css rules? ie:
I have a listing of divs (playlist) which I color with the following rules:

#playlist .playlist_item { 
  background: #d6d6d6;
}

#playlist .playlist_item:nth-child(odd) {
  background: #b3b3b3;
}

Now, when a song is playing, I use setInterval and JQuery's .animate function to pulse the background color. When the song is finished I clear the interval, but of course the song's background remains the last color set in the interval. Is there a way to re-set the song's color based on the CSS rule? Otherwise I'll have to keep track of the previous song (which may have changed position, and thus color) or setup distinct background color classes and reset the classes of all the songs in the playlist anytime someone adds, removes, or moves a song in the playlist or a song ends. I'd much rather use a CSS only approach.

Thanks in advance, Dan

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about css