bootstrap-transition.js 1.76 KB
Newer Older
1
/* ===================================================
Jacob Thornton's avatar
Jacob Thornton committed
2
 * bootstrap-transition.js v2.0.4
Jon Stevens's avatar
Jon Stevens committed
3
 * http://twitter.github.com/bootstrap/javascript.html#transitions
4
 * ===================================================
Mark Otto's avatar
Mark Otto committed
5
 * Copyright 2012 Twitter, Inc.
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ========================================================== */

20

21
!function ($) {
22

Jacob Thornton's avatar
Jacob Thornton committed
23
  $(function () {
Jacob Thornton's avatar
Jacob Thornton committed
24

25
26
    "use strict"; // jshint ;_;

27

Jacob Thornton's avatar
Jacob Thornton committed
28
    /* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
Jacob Thornton's avatar
Jacob Thornton committed
29
     * ======================================================= */
30

Jacob Thornton's avatar
Jacob Thornton committed
31
    $.support.transition = (function () {
Jacob Thornton's avatar
Jacob Thornton committed
32

33
34
35
36
37
38
      var transitionEnd = (function () {

        var el = document.createElement('bootstrap')
          , transEndEventNames = {
               'WebkitTransition' : 'webkitTransitionEnd'
            ,  'MozTransition'    : 'transitionend'
39
            ,  'OTransition'      : 'otransitionend'
40
            ,  'msTransition'     : 'MSTransitionEnd'
41
            ,  'transition'       : 'transitionend'
Jacob Thornton's avatar
Jacob Thornton committed
42
            }
43
44
45
46
47
          , name

        for (name in transEndEventNames){
          if (el.style[name] !== undefined) {
            return transEndEventNames[name]
Jacob Thornton's avatar
Jacob Thornton committed
48
          }
49
        }
Jacob Thornton's avatar
Jacob Thornton committed
50

Jacob Thornton's avatar
Jacob Thornton committed
51
      }())
Jacob Thornton's avatar
Jacob Thornton committed
52

53
54
      return transitionEnd && {
        end: transitionEnd
Jacob Thornton's avatar
Jacob Thornton committed
55
      }
56

Jacob Thornton's avatar
Jacob Thornton committed
57
58
59
    })()

  })
60

61
}(window.jQuery);