Skip to content

Commit 8bf4812

Browse files
committed
Merge pull request twbs#14061 from hnrch02/fix-13656
Expose transition durations on plugin constructors; closes twbs#13656
2 parents 948a746 + 231744d commit 8bf4812

File tree

6 files changed

+24
-11
lines changed

6 files changed

+24
-11
lines changed

js/alert.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
Alert.VERSION = '3.2.0'
2222

23+
Alert.TRANSITION_DURATION = 150
24+
2325
Alert.prototype.close = function (e) {
2426
var $this = $(this)
2527
var selector = $this.attr('data-target')
@@ -51,7 +53,7 @@
5153
$.support.transition && $parent.hasClass('fade') ?
5254
$parent
5355
.one('bsTransitionEnd', removeElement)
54-
.emulateTransitionEnd(150) :
56+
.emulateTransitionEnd(Alert.TRANSITION_DURATION) :
5557
removeElement()
5658
}
5759

js/carousel.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
Carousel.VERSION = '3.2.0'
3232

33+
Carousel.TRANSITION_DURATION = 600
34+
3335
Carousel.DEFAULTS = {
3436
interval: 5000,
3537
pause: 'hover',
@@ -153,7 +155,7 @@
153155
that.$element.trigger(slidEvent)
154156
}, 0)
155157
})
156-
.emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
158+
.emulateTransitionEnd(Carousel.TRANSITION_DURATION)
157159
} else {
158160
$active.removeClass('active')
159161
$next.addClass('active')

js/collapse.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
Collapse.VERSION = '3.2.0'
2626

27+
Collapse.TRANSITION_DURATION = 350
28+
2729
Collapse.DEFAULTS = {
2830
toggle: true
2931
}
@@ -72,7 +74,7 @@
7274

7375
this.$element
7476
.one('bsTransitionEnd', $.proxy(complete, this))
75-
.emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])
77+
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
7678
}
7779

7880
Collapse.prototype.hide = function () {
@@ -105,7 +107,7 @@
105107
this.$element
106108
[dimension](0)
107109
.one('bsTransitionEnd', $.proxy(complete, this))
108-
.emulateTransitionEnd(350)
110+
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)
109111
}
110112

111113
Collapse.prototype.toggle = function () {

js/modal.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232

3333
Modal.VERSION = '3.2.0'
3434

35+
Modal.TRANSITION_DURATION = 300
36+
Modal.BACKDROP_TRANSITION_DURATION = 150
37+
3538
Modal.DEFAULTS = {
3639
backdrop: true,
3740
keyboard: true,
@@ -88,7 +91,7 @@
8891
.one('bsTransitionEnd', function () {
8992
that.$element.trigger('focus').trigger(e)
9093
})
91-
.emulateTransitionEnd(300) :
94+
.emulateTransitionEnd(Modal.TRANSITION_DURATION) :
9295
that.$element.trigger('focus').trigger(e)
9396
})
9497
}
@@ -119,7 +122,7 @@
119122
$.support.transition && this.$element.hasClass('fade') ?
120123
this.$element
121124
.one('bsTransitionEnd', $.proxy(this.hideModal, this))
122-
.emulateTransitionEnd(300) :
125+
.emulateTransitionEnd(Modal.TRANSITION_DURATION) :
123126
this.hideModal()
124127
}
125128

@@ -182,7 +185,7 @@
182185
doAnimate ?
183186
this.$backdrop
184187
.one('bsTransitionEnd', callback)
185-
.emulateTransitionEnd(150) :
188+
.emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
186189
callback()
187190

188191
} else if (!this.isShown && this.$backdrop) {
@@ -195,7 +198,7 @@
195198
$.support.transition && this.$element.hasClass('fade') ?
196199
this.$backdrop
197200
.one('bsTransitionEnd', callbackRemove)
198-
.emulateTransitionEnd(150) :
201+
.emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
199202
callbackRemove()
200203

201204
} else if (callback) {

js/tab.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
Tab.VERSION = '3.2.0'
2121

22+
Tab.TRANSITION_DURATION = 150
23+
2224
Tab.prototype.show = function () {
2325
var $this = this.element
2426
var $ul = $this.closest('ul:not(.dropdown-menu)')
@@ -82,7 +84,7 @@
8284
$active.length && transition ?
8385
$active
8486
.one('bsTransitionEnd', next)
85-
.emulateTransitionEnd(150) :
87+
.emulateTransitionEnd(Tab.TRANSITION_DURATION) :
8688
next()
8789

8890
$active.removeClass('in')

js/tooltip.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727

2828
Tooltip.VERSION = '3.2.0'
2929

30+
Tooltip.TRANSITION_DURATION = 150
31+
3032
Tooltip.DEFAULTS = {
3133
animation: true,
3234
placement: 'top',
@@ -207,7 +209,7 @@
207209
$.support.transition && this.$tip.hasClass('fade') ?
208210
$tip
209211
.one('bsTransitionEnd', complete)
210-
.emulateTransitionEnd(150) :
212+
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
211213
complete()
212214
}
213215
}
@@ -295,7 +297,7 @@
295297
$.support.transition && this.$tip.hasClass('fade') ?
296298
$tip
297299
.one('bsTransitionEnd', complete)
298-
.emulateTransitionEnd(150) :
300+
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
299301
complete()
300302

301303
this.hoverState = null

0 commit comments

Comments
 (0)