Skip to content

Instantly share code, notes, and snippets.

@utgarda
Created January 2, 2012 20:55
Show Gist options
  • Select an option

  • Save utgarda/1552072 to your computer and use it in GitHub Desktop.

Select an option

Save utgarda/1552072 to your computer and use it in GitHub Desktop.
CoffeeScript + jQuery animation example http://coffeequery.blogspot.com
#Using $j instead of just $ to be more specific
$j = jQuery
#Storing page elements to local variables
clickme = $j '#ani1_clickme'
restore = $j '#ani1_restore'
bar1 = $j '#ani1_bar1'
bar2 = $j '#ani1_bar2'
#Cool shortcut, instead of $j(document).ready(function(){
$j ->
clickme.click ->
bar1.animate {width:150}, 2000
bar2.animate {width:350}, 4000
restore.click ->
bar1.animate {width:350}, 4000
bar2.animate {width:150}, 2000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment