emulateTransitionEnd in bootstrap.js , where is it coming from?
javascript, jquery, twitter-bootstrap
Solution
It's a custom Bootstrap function declared here
https://github.com/twbs/bootstrap/blob/83bfff7f0765503b990b96c303eef67009e48d77/js/transition.js#L36
It's a functions that fires event (once) on $.support.transition.end
$.support.transition.end contains one of these events:
- webkitTransitionEnd
- transitionend
- oTransitionEnd
- otransitionend
- transitionend
You can find more informations here
how to listen to the end of a bootstrap animation
Problem
I was just debugging modal.js and came across the following piece of code : ``` that.$element.find('.modal-dialog') // wait for modal to slide in .one('bsTransitionEnd', function () { that.$element.trigger('focus').trigger(e) }) .emulateTransitionEnd(Modal.TRANSITION_DURATION) : that.$element.trigger('focus').trigger(e) ``` my question is about the following line : ``` emulateTransitionEnd(Modal.TRANSITION_DURATION) : ``` What is that? A jQuery function? A custom function in bootstrap? I googled about this function, but could barely find anything, I am guessing it's a custom bootstrap function. But then I don't see this function in my modal.js (a subset of bootstrap.js) at all . I saw the following somewhere : link. What is this `emulateTransitionEnd` really ? And where is it defined and what is it doing ? You can find the line I am talking about here : line 99 modal.js