diff options
author | Jacob Thornton <jacobthornton@gmail.com> | 2012-03-29 23:35:06 +0400 |
---|---|---|
committer | Jacob Thornton <jacobthornton@gmail.com> | 2012-03-29 23:35:06 +0400 |
commit | 8ea8c312ea631ec7f8c80ae8751da18e93094a4e (patch) | |
tree | 1294a13172920632edc431208a2d0ad11f18162b /js | |
parent | 2bbc9a1cb225ded877b9228ebf714ccb74f07c6d (diff) |
replace UA sniffing
Diffstat (limited to 'js')
-rw-r--r-- | js/bootstrap-transition.js | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/js/bootstrap-transition.js b/js/bootstrap-transition.js index 8c82cc311f..7b0113484c 100644 --- a/js/bootstrap-transition.js +++ b/js/bootstrap-transition.js @@ -24,28 +24,35 @@ "use strict" - /* CSS TRANSITION SUPPORT (https://gist.github.com/373874) + /* CSS TRANSITION SUPPORT (technique from http://www.modernizr.com/) * ======================================================= */ $.support.transition = (function () { + var thisBody = document.body || document.documentElement , thisStyle = thisBody.style , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined return support && { end: (function () { - var transitionEnd = "TransitionEnd" - if ( $.browser.webkit ) { - transitionEnd = "webkitTransitionEnd" - } else if ( $.browser.mozilla ) { - transitionEnd = "transitionend" - } else if ( $.browser.msie ) { - transitionEnd = "MSTransitionEnd" - } else if ( $.browser.opera ) { - transitionEnd = "oTransitionEnd" + var el = document.createElement('bootstrap') + , transEndEventNames = { + 'WebkitTransition' : 'webkitTransitionEnd' + , 'MozTransition' : 'transitionend' + , 'OTransition' : 'oTransitionEnd' + , 'msTransition' : 'MsTransitionEnd' + , 'transition' : 'transitionend' + } + , name + + for (name in transEndEventNames){ + if (el.style[name] !== undefined) { + return transEndEventNames[name] + } } - return transitionEnd + }()) + } })() |