How to reinforce pseudo css rules
- by danwoods
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