Skip to content

Instantly share code, notes, and snippets.

@taea
Last active December 13, 2015 23:59
Show Gist options
  • Save taea/4995866 to your computer and use it in GitHub Desktop.
Save taea/4995866 to your computer and use it in GitHub Desktop.
listが一定間隔でスクロールしてくるくる回るやつ
$ ->
targetUl = "ul#autoScroll"
targetList = "ul#autoScroll li"
targetListHeight = $(targetList).height()
delayTime = 4000
scrollDistance = (-1 * targetListHeight) + 'px'
setInterval (->
$(targetUl).find("li:first").appendTo(targetUl).show()
$(targetUl).find("li:first").hide ->
$(this).animate {'top': scrollDistance}, "slow", ->
$(this).find("li:last").show()
), delayTime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment