Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tylersticka/5507143 to your computer and use it in GitHub Desktop.
Save tylersticka/5507143 to your computer and use it in GitHub Desktop.
Rough transitionEnd binding for Knockout
/*
* Sample usage:
* <div data-bind="transitionEnd: modelMethod"></div>
*
* Issues:
* - Webkit-only event name
* - Fires multiple times when multiple properties are transitioned
*/
ko.bindingHandlers.transitionEnd = {
init: function (element, valueAccessor) {
ko.utils.registerEventHandler(element, "webkitTransitionEnd", function (event) {
var callback = valueAccessor();
callback(ko.dataFor(element), event);
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment