Skip to content

Instantly share code, notes, and snippets.

@mcspring
Created July 25, 2012 04:01
Show Gist options
  • Save mcspring/3174306 to your computer and use it in GitHub Desktop.
Save mcspring/3174306 to your computer and use it in GitHub Desktop.
Write functionality jQuery code with coffeescript
# utils
global_function ->
# do something...
# if your function is a *process*, known as do not return anything, plus true as the last statement!
jQuery ($) ->
# global events bind 1
el1 = $ 'selector1'
el1.on 'event', (evt) ->
# do something...
true # or false
# global events bind 2
el2 = $ 'selector2'
el2.on 'event', (evt) ->
# do something...
true # or false
# page init statements
# do something directly...
# avoid extra return statement
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment