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