Skip to content

Instantly share code, notes, and snippets.

@atelic
Last active October 27, 2015 15:38
Show Gist options
  • Save atelic/b7268a91248c05d03fd8 to your computer and use it in GitHub Desktop.
Save atelic/b7268a91248c05d03fd8 to your computer and use it in GitHub Desktop.
// Bind Bootstrap Progress
ko.bindingHandlers.progress = {
init: function (element, valueAccessor) {
var $element = $(element);
var bar = $('<div/>', {
'class': 'progress-bar',
'role': 'progressbar',
'aria-valuemin': 0,
'aria-valuemax': 100,
'aria-valuenow': valueAccessor(),
'data-bind': 'style: { width:' + valueAccessor() + '% }'
});
$element.addClass('progress progress-info')
.append(bar);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment