This fiddle works as intended, when the last li has a class on, the first li gets a class of first.
I am trying to use the same principle with the jQuery Cycle plugin. If you have a look at this fiddle you will see that the cycle plugin adds a class of activeSlide to the active slide. I have put some code in fidle which I thought would handle it but it looks as though maybe I have my logic wrong?