diff options
| author | Caitlin Potter | 2014-02-06 14:02:18 +0000 |
|---|---|---|
| committer | Peter Bacon Darwin | 2014-02-16 19:03:40 +0000 |
| commit | f7d28cd377f06224247b950680517a187a7b6749 (patch) | |
| tree | 20203b9f7bf60748bb752f325b1869415352a6f3 /docs/content/guide/animations.ngdoc | |
| parent | 2e641ac49f121a6e2cc70bd3879930b44a8a7710 (diff) | |
| download | angular.js-f7d28cd377f06224247b950680517a187a7b6749.tar.bz2 | |
docs(all): convert <pre>/</pre> snippets to GFM snippets
Diffstat (limited to 'docs/content/guide/animations.ngdoc')
| -rw-r--r-- | docs/content/guide/animations.ngdoc | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/docs/content/guide/animations.ngdoc b/docs/content/guide/animations.ngdoc index 1178d774..a9dd6ac6 100644 --- a/docs/content/guide/animations.ngdoc +++ b/docs/content/guide/animations.ngdoc @@ -64,11 +64,11 @@ You may also want to setup a separate CSS file for defining CSS-based animations Animations in AngularJS are completely based on CSS classes. As long as you have a CSS class attached to a HTML element within your website, you can apply animations to it. Lets say for example that we have an HTML template with a repeater in it like so: -<pre> +```html <div ng-repeat="item in items" class="repeated-item"> {{ item.id }} </div> -</pre> +``` As you can see, the `.repeated-item` class is present on the element that will be repeated and this class will be used as a reference within our application's CSS and/or JavaScript animation code to tell AngularJS to perform an animation. @@ -80,13 +80,13 @@ it will apply a `ng-move` class name. Taking a look at the following CSS code, we can see some transition and keyframe animation code set for each of those events that occur when ngRepeat triggers them: -<pre> -/* +```css +/* We're using CSS transitions for when the enter and move events are triggered for the element that has the .repeated-item class -*/ +*/ .repeated-item.ng-enter, .repeated-item.ng-move { -webkit-transition:0.5s linear all; -moz-transition:0.5s linear all; @@ -95,22 +95,22 @@ occur when ngRepeat triggers them: opacity:0; } -/* +/* The ng-enter-active and ng-move-active are where the transition destination properties are set so that the animation knows what to animate. -*/ +*/ .repeated-item.ng-enter.ng-enter-active, .repeated-item.ng-move.ng-move-active { opacity:1; } -/* +/* We're using CSS keyframe animations for when the leave event is triggered for the element that has the .repeated-item class -*/ +*/ .repeated-item.ng-leave { -webkit-animation:0.5s my_animation; -moz-animation:0.5s my_animation; @@ -118,34 +118,34 @@ occur when ngRepeat triggers them: animation:0.5s my_animation; } -@keyframes my_animation { +@keyframes my_animation { from { opacity:1; } to { opacity:0; } } -/* +/* Unfortunately each browser vendor requires its own definition of keyframe animation code... -*/ -@-webkit-keyframes my_animation { +*/ +@-webkit-keyframes my_animation { from { opacity:1; } to { opacity:0; } } -@-moz-keyframes my_animation { +@-moz-keyframes my_animation { from { opacity:1; } to { opacity:0; } } -@-o-keyframes my_animation { +@-o-keyframes my_animation { from { opacity:1; } to { opacity:0; } } -</pre> +``` The same approach to animation can be used using JavaScript code (**jQuery is used within to perform animations**): -<pre> +```js myModule.animation('.repeated-item', function() { return { enter : function(element, done) { @@ -199,7 +199,7 @@ myModule.animation('.repeated-item', function() { removeClass : function(element, className, done) {} } }); -</pre> +``` With these generated CSS class names present on the element at the time, AngularJS automatically figures out whether to perform a CSS and/or JavaScript animation. If both CSS and JavaScript animation @@ -268,7 +268,7 @@ For a full breakdown of the steps involved during each animation event, refer to Animations within custom directives can also be established by injecting `$animate` directly into your directive and making calls to it when needed. -<pre> +```js myModule.directive('my-directive', ['$animate', function($animate) { return function(element, scope, attrs) { element.bind('click', function() { @@ -280,7 +280,7 @@ myModule.directive('my-directive', ['$animate', function($animate) { }); }; }]); -</pre> +``` ## More about animations |
