KamaKAzii
5/30/2015 - 1:48 PM

gistfile1.coffee

      $timeoutId = $interval ((->
        $orderedLis = $ul.find('li')
        $topLi = $orderedLis.eq(0)
        $secondLi = $orderedLis.eq(1)
        $thirdLi = $orderedLis.eq(2)

        $topLi.animate { opacity: 0 }, fade, ->
          $secondLi.css { 'z-index': '0' }
          $thirdLi.css { 'z-index': '-1' } if $thirdLi?

          targetZIndex = ($orderedLis.length - 1) * -1
          $topLi.remove()
          $topLi.appendTo($ul)
          $topLi.css {
            'opacity': '1'
            'z-index': targetZIndex
          }
      ), delay)