twitter-bootstrap bootstrap.js 中的 emulateTransitionEnd ,它来自哪里?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28753211/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
emulateTransitionEnd in bootstrap.js , where is it coming from?
提问by Alexander Solonik
I was just debugging modal.js and came across the following piece of code :
我只是在调试 modal.js 并遇到以下代码:
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?
那是什么?一个 jQuery 函数?引导程序中的自定义函数?
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 .
我在谷歌上搜索了这个函数,但几乎找不到任何东西,我猜这是一个自定义引导函数。但是后来我在我的 modal.js(bootstrap.js 的一个子集)中根本没有看到这个函数。
I saw the following somewhere : link.
我在某处看到以下内容:链接。
What is this emulateTransitionEndreally ? And where is it defined and what is it doing ?
这究竟是emulateTransitionEnd什么?它在哪里定义,它在做什么?
You can find the line I am talking about here : line 99 modal.js
你可以在这里找到我正在谈论的那一行:第 99 行 modal.js
回答by Diego Betto
It's a custom Bootstrap function declared here
这是一个在这里声明的自定义 Bootstrap 函数
https://github.com/twbs/bootstrap/blob/83bfff7f0765503b990b96c303eef67009e48d77/js/transition.js#L36
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 上触发事件(一次)的函数
$.support.transition.endcontains one of these events:
$.support.transition.end包含以下事件之一:
- webkitTransitionEnd
- transitionend
- oTransitionEnd
- otransitionend
- transitionend
- webkit转换结束
- 过渡结束
- o过渡结束
- 过渡端
- 过渡结束
You can find more informations here
你可以在这里找到更多信息

