Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created October 6, 2015 13:51
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 chuck0523/6e54466675e57d07851e to your computer and use it in GitHub Desktop.
Save chuck0523/6e54466675e57d07851e to your computer and use it in GitHub Desktop.
$ ->
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