mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-29 06:49:06 +02:00
Variable transition durations (#25662)
This commit is contained in:
committed by
Johann-S
parent
1859595cb6
commit
1fadad1c33
@@ -17,6 +17,7 @@ const Util = (($) => {
|
||||
let transition = false
|
||||
|
||||
const MAX_UID = 1000000
|
||||
const MILLISECONDS_MULTIPLIER = 1000
|
||||
|
||||
// Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||
function toType(obj) {
|
||||
@@ -104,6 +105,23 @@ const Util = (($) => {
|
||||
}
|
||||
},
|
||||
|
||||
getTransitionDurationFromElement(element) {
|
||||
// Get transition-duration of the element
|
||||
let transitionDuration = $(element).css('transition-duration')
|
||||
|
||||
// Return 0 if element or transition duration is not found
|
||||
if (!transitionDuration) {
|
||||
return 0
|
||||
}
|
||||
|
||||
// If multiple durations are defined, take the first
|
||||
transitionDuration = transitionDuration.split(',')[0]
|
||||
|
||||
// jQuery always converts transition durations into seconds,
|
||||
// so multiply by 1000
|
||||
return parseFloat(transitionDuration) * MILLISECONDS_MULTIPLIER
|
||||
},
|
||||
|
||||
reflow(element) {
|
||||
return element.offsetHeight
|
||||
},
|
||||
|
Reference in New Issue
Block a user