Advertisement
Guest User

Untitled

a guest
Oct 6th, 2015
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. $ ->
  2. log = (x) ->
  3. console.log x
  4.  
  5. navs = $('#navs').children()
  6. divs = $('#divs').children()
  7.  
  8. crntPage = 0;
  9.  
  10. # @ means 'this'! wow!
  11. navs.each (index) ->
  12. $(@).click ->
  13.  
  14. diff = index - crntPage
  15.  
  16. # ここの処理もっとスマートにしたい
  17. deg = if diff > 0 then 0 else -180
  18. range = if diff > 0 then [crntPage..index] else [crntPage...index]
  19.  
  20. # 覆う処理とめくる処理とでは、似ている処理のようだけどindexの終端がずれる
  21. for i in range
  22. $(divs[i]).css 'transform', "rotateZ(#{deg}deg)"
  23.  
  24. crntPage = index
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement