rikukissa
4/16/2013 - 9:39 AM

fadeVisible.coffee

  ko.bindingHandlers.fadeVisible =
    init: (element, valueAccessor) ->
      value = valueAccessor()
      $(element).toggle ko.utils.unwrapObservable(value)
    update: (element, valueAccessor) ->
      value = valueAccessor()
      (if ko.utils.unwrapObservable(value) then $(element).fadeIn(1000) else $(element).fadeOut(1000))