Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$ ->
log = (x) ->
console.log x
navs = $('#navs').children()
divs = $('#divs').children()
crntPage = 0;
# @ means 'this'! wow!
navs.each (index) ->
$(@).click ->
diff = index - crntPage
# ここの処理もっとスマートにしたい
deg = if diff > 0 then 0 else -180
range = if diff > 0 then [crntPage..index] else [crntPage...index]
# 覆う処理とめくる処理とでは、似ている処理のようだけどindexの終端がずれる
for i in range
$(divs[i]).css 'transform', "rotateZ(#{deg}deg)"
crntPage = index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment