Created
November 21, 2012 06:36
-
-
Save victor-homyakov/4123398 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
transition: function (method, startEvent, completeEvent) { | |
var that = this | |
, complete = function (e) { | |
if (this.transitioning) { | |
if (e.type == 'show') this.reset() | |
this.transitioning = 0 | |
this.$element.trigger(completeEvent) | |
} | |
} | |
this.$element.trigger(startEvent) | |
if (startEvent.isDefaultPrevented()) return | |
this.transitioning = 1 | |
if ($.support.transition && this.$element.hasClass('collapse')) { | |
// assign callback to transition end event, then start transition | |
this.$element.one($.support.transition.end, complete) | |
this.$element[method]('in') | |
// guarantee callback invokation | |
// timeout is equal to transition time from component-animations.less | |
setTimeout(function(){ | |
complete.call(that, startEvent); | |
}, 350) | |
} else { | |
this.$element[method]('in') | |
complete.call(this, startEvent) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment