Skip to content

Instantly share code, notes, and snippets.

@ivanovvitaly
ivanovvitaly / knockout.bindings.js
Last active July 26, 2016 13:54
My simple and usefull knockout binding handlers I always use
// Requires BlockUI
ko.bindingHandlers.blockUI = {
update: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
var isEnabled = ko.unwrap(valueAccessor()) || false;
if (isEnabled) {
$(element).block();
}
else {
$(element).unblock();
}