forked from brandonaaron/jquery-cssHooks
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtransition.js
45 lines (39 loc) · 1.52 KB
/
transition.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*! Copyright (c) 2010 Burin Asavesna (http://helloburin.com)
* Licensed under the MIT License (LICENSE.txt).
*/
(function($) {
var div = document.createElement('div'),
divStyle = div.style,
support = $.support,
props = "Property Duration TimingFunction".split(" ");
support.transition =
divStyle.MozTransition === ''? 'MozTransition' :
(divStyle.MsTransition === ''? 'MsTransition' :
(divStyle.WebkitTransition === ''? 'WebkitTransition' :
(divStyle.OTransition === ''? 'OTransition' :
(divStyle.transition === ''? 'Transition' :
false))));
div = null;
if ( support.transition && support.transition !== "Transition" ) {
$.cssHooks.transition = {
get: function( elem, computed, extra ) {
return $.map(props, function( prop, i ) {
return $.css(elem, support.transition + prop);
}).join(" ");
},
set: function( elem, value ) {
elem.style[ support.transition ] = value;
}
};
$.each(props, function( i, prop ) {
$.cssHooks[ "transition" + prop ] = {
get: function( elem, computed, extra ) {
return $.css(elem, support.transition + prop);
},
set: function( elem, value ) {
elem.style[ support.transition + prop ] = value;
}
};
});
}
})(jQuery);