Created
January 2, 2012 20:55
-
-
Save utgarda/1552072 to your computer and use it in GitHub Desktop.
CoffeeScript + jQuery animation example http://coffeequery.blogspot.com
This file contains hidden or 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
| #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