comparison static/bootstrap/js/transition.js @ 149:d29e2f337b00

Updated to Bootstrap 3.0.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 12 Dec 2013 21:54:04 -0800
parents
children
comparison
equal deleted inserted replaced
148:f02e049d6546 149:d29e2f337b00
1 /* ========================================================================
2 * Bootstrap: transition.js v3.0.3
3 * http://getbootstrap.com/javascript/#transitions
4 * ========================================================================
5 * Copyright 2013 Twitter, Inc.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ======================================================================== */
19
20
21 +function ($) { "use strict";
22
23 // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
24 // ============================================================
25
26 function transitionEnd() {
27 var el = document.createElement('bootstrap')
28
29 var transEndEventNames = {
30 'WebkitTransition' : 'webkitTransitionEnd'
31 , 'MozTransition' : 'transitionend'
32 , 'OTransition' : 'oTransitionEnd otransitionend'
33 , 'transition' : 'transitionend'
34 }
35
36 for (var name in transEndEventNames) {
37 if (el.style[name] !== undefined) {
38 return { end: transEndEventNames[name] }
39 }
40 }
41 }
42
43 // http://blog.alexmaccaw.com/css-transitions
44 $.fn.emulateTransitionEnd = function (duration) {
45 var called = false, $el = this
46 $(this).one($.support.transition.end, function () { called = true })
47 var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
48 setTimeout(callback, duration)
49 return this
50 }
51
52 $(function () {
53 $.support.transition = transitionEnd()
54 })
55
56 }(jQuery);