Created
October 6, 2015 13:51
-
-
Save chuck0523/6e54466675e57d07851e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ -> | |
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