Skip to content

Instantly share code, notes, and snippets.

@rikukissa
Created April 16, 2013 09:39
Show Gist options
  • Save rikukissa/5394684 to your computer and use it in GitHub Desktop.
Save rikukissa/5394684 to your computer and use it in GitHub Desktop.
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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment