Skip to content

Instantly share code, notes, and snippets.

@EdwardIII
Created March 21, 2013 14:47
Show Gist options
  • Save EdwardIII/5213602 to your computer and use it in GitHub Desktop.
Save EdwardIII/5213602 to your computer and use it in GitHub Desktop.
ko.bindingHandlers.slideVisible = {
init: function(element, valueAccessor) {
var value = ko.utils.unwrapObservable(valueAccessor()); // Get the current value of the current property we're bound to
$(element).toggle(value); // jQuery will hide/show the element depending on whether "value" or true or false
},
update: function(element, valueAccessor, allBindingsAccessor) {
// Leave as before
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment