Skip to content

Instantly share code, notes, and snippets.

@gaina-jp
Created September 13, 2014 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaina-jp/4e491d7c24117f0abc26 to your computer and use it in GitHub Desktop.
Save gaina-jp/4e491d7c24117f0abc26 to your computer and use it in GitHub Desktop.
お手軽フェードするギャラリーのやつ
$gallary = $("#gallary").find("li")
_gallaryTime = 4000
_animateTime = 800
gallaryLoop = (num)->
_num = num | 0
$gallary.each((i)->
$that = $(this)
if i is _num
$that
.stop()
.animate(
{opacity:1},
_animateTime,
()->
_num++
_num = _num % ($gallary.length)
_timeout = setTimeout(
()->
gallaryLoop(_num)
clearTimeout(_timeout)
return
,_gallaryTime
)
return
)
else
$that.stop().animate({opacity:0},_animateTime)
return
)
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment