bootstrap-transition.js 1.72 KB
Newer Older
1
/* ===================================================
Mark Otto's avatar
Mark Otto committed
2
 * bootstrap-transition.js v3.0.0
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

23
  "use strict"; // jshint ;_;
Jacob Thornton's avatar
Jacob Thornton committed
24

25

26
27
  /* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
   * ======================================================= */
28

29
  $(function () {
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 otransitionend'
40
            ,  'transition'       : 'transitionend'
Jacob Thornton's avatar
Jacob Thornton committed
41
            }
42
43
44
45
46
          , name

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

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

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

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

  })
59

60
}(window.jQuery);