@@ -12,6 +12,13 @@ triggered, will attempt to perform a CSS Transition, CSS Keyframe Animation or a
12
12
placed on the given directive). Animations can be placed using vanilla CSS by following the naming conventions set in place by AngularJS
13
13
or with JavaScript code when it's defined as a factory.
14
14
15
+ <div class="alert alert-info">
16
+ Note that we have used non-prefixed CSS transition properties in our examples as the major browsers now support non-prefixed
17
+ properties. If you intend to support older browsers or certain mobile browsers then you will need to include prefixed
18
+ versions of the transition properties. Take a look at http://caniuse.com/#feat=css-transitions for what browsers require prefixes,
19
+ and https://github.com/postcss/autoprefixer for a tool that can automatically generate the prefixes for you.
20
+ </div>
21
+
15
22
Animations are not available unless you include the {@link ngAnimate `ngAnimate` module} as a dependency within your application.
16
23
17
24
Below is a quick example of animations being enabled for `ngShow` and `ngHide`:
@@ -29,18 +36,17 @@ Below is a quick example of animations being enabled for `ngShow` and `ngHide`:
29
36
</file>
30
37
<file name="animations.css">
31
38
.sample-show-hide {
32
- padding:10px;
33
- border:1px solid black;
34
- background:white;
39
+ padding: 10px;
40
+ border: 1px solid black;
41
+ background: white;
35
42
}
36
43
37
44
.sample-show-hide {
38
- -webkit-transition:all linear 0.5s;
39
- transition:all linear 0.5s;
45
+ transition: all linear 0.5s;
40
46
}
41
47
42
48
.sample-show-hide.ng-hide {
43
- opacity:0;
49
+ opacity: 0;
44
50
}
45
51
</file>
46
52
</example>
@@ -80,11 +86,8 @@ occur when ngRepeat triggers them:
80
86
class
81
87
*/
82
88
.repeated-item.ng-enter, .repeated-item.ng-move {
83
- -webkit-transition:0.5s linear all;
84
- -moz-transition:0.5s linear all;
85
- -o-transition:0.5s linear all;
86
- transition:0.5s linear all;
87
- opacity:0;
89
+ transition: all 0.5s linear;
90
+ opacity: 0;
88
91
}
89
92
90
93
/*
@@ -95,7 +98,7 @@ occur when ngRepeat triggers them:
95
98
*/
96
99
.repeated-item.ng-enter.ng-enter-active,
97
100
.repeated-item.ng-move.ng-move-active {
98
- opacity:1;
101
+ opacity: 1;
99
102
}
100
103
101
104
/*
@@ -104,35 +107,14 @@ occur when ngRepeat triggers them:
104
107
that has the .repeated-item class
105
108
*/
106
109
.repeated-item.ng-leave {
107
- -webkit-animation:0.5s my_animation;
108
- -moz-animation:0.5s my_animation;
109
- -o-animation:0.5s my_animation;
110
- animation:0.5s my_animation;
110
+ animation: 0.5s my_animation;
111
111
}
112
112
113
113
@keyframes my_animation {
114
114
from { opacity:1; }
115
115
to { opacity:0; }
116
116
}
117
117
118
- /*
119
- Unfortunately each browser vendor requires
120
- its own definition of keyframe animation code...
121
- */
122
- @-webkit-keyframes my_animation {
123
- from { opacity:1; }
124
- to { opacity:0; }
125
- }
126
-
127
- @-moz-keyframes my_animation {
128
- from { opacity:1; }
129
- to { opacity:0; }
130
- }
131
-
132
- @-o-keyframes my_animation {
133
- from { opacity:1; }
134
- to { opacity:0; }
135
- }
136
118
```
137
119
138
120
The same approach to animation can be used using JavaScript code (**jQuery is used within to perform animations**):
@@ -217,10 +199,7 @@ The example below shows how to perform animations during class changes:
217
199
</file>
218
200
<file name="style.css">
219
201
.css-class-add, .css-class-remove {
220
- -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
221
- -moz-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
222
- -o-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
223
- transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
202
+ transition: all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
224
203
}
225
204
226
205
.css-class,
@@ -231,7 +210,7 @@ The example below shows how to perform animations during class changes:
231
210
232
211
.css-class-remove.css-class-remove-active {
233
212
font-size:1.0em;
234
- color:black;
213
+ color: black;
235
214
}
236
215
</file>
237
216
</example>
@@ -317,8 +296,8 @@ app.config(function($animateProvider) {
317
296
```css
318
297
/* prefixed with animate- */
319
298
.animate-fade-add.animate-fade-add-active {
320
- transition:1s linear all ;
321
- opacity:0;
299
+ transition: all 1s linear;
300
+ opacity: 0;
322
301
}
323
302
```
324
303
0 commit comments