aboutsummaryrefslogtreecommitdiffstats
path: root/docs/content/tutorial/step_12.ngdoc
diff options
context:
space:
mode:
authormatthewhintzen2014-01-22 14:19:00 +1300
committerIgor Minar2014-01-21 17:23:05 -0800
commit7cf5544a9f5bea443ccac2143765154760ceaff9 (patch)
treeb061bf6d5154cd3fbc16bed2769bb242980ac1d2 /docs/content/tutorial/step_12.ngdoc
parent030a9b8d33767d0b27104b6208797ab837f4b892 (diff)
downloadangular.js-7cf5544a9f5bea443ccac2143765154760ceaff9.tar.bz2
docs(tutorial): update step_12.ngdoc
This time I feel good about this modification to the document, the code listing on the tutorial page for the animation.js DID NOT match what was actually IN the file for that branch. Updated tutorial to reflect actual contents of file Closes #5922
Diffstat (limited to 'docs/content/tutorial/step_12.ngdoc')
-rw-r--r--docs/content/tutorial/step_12.ngdoc87
1 files changed, 50 insertions, 37 deletions
diff --git a/docs/content/tutorial/step_12.ngdoc b/docs/content/tutorial/step_12.ngdoc
index ba281c01..b611e072 100644
--- a/docs/content/tutorial/step_12.ngdoc
+++ b/docs/content/tutorial/step_12.ngdoc
@@ -340,45 +340,58 @@ Although we could do that, let's take the opportunity to learn how to create Jav
__`app/js/animations.js`.__
<pre>
-angular.module('phonecatAnimations', ['ngAnimate'])
-
- .animation('.phone', function() {
- return {
- addClass : function(element, className, done) {
- if(className != 'active') {
- return;
- }
- element.css({
- position: 'absolute',
- top: 500,
- left: 0,
- display: 'block'
- });
- jQuery(element).animate({
- top: 0
- }, done);
-
- return function(cancel) {
- if(cancel) element.stop();
- };
- },
- removeClass : function(element, className, done) {
- if(className != 'active') return;
- element.css({
- position: 'absolute',
- left: 0,
- top: 0
- });
- jQuery(element).animate({
- top: -500
- }, done);
-
- return function(cancel) {
- if(cancel) element.stop();
- };
+var phonecatAnimations = angular.module('phonecatAnimations', ['ngAnimate']);
+
+phonecatAnimations.animation('.phone', function() {
+
+ var animateUp = function(element, className, done) {
+ if(className != 'active') {
+ return;
+ }
+ element.css({
+ position: 'absolute',
+ top: 500,
+ left: 0,
+ display: 'block'
+ });
+
+ jQuery(element).animate({
+ top: 0
+ }, done);
+
+ return function(cancel) {
+ if(cancel) {
+ element.stop();
}
};
- });
+ }
+
+ var animateDown = function(element, className, done) {
+ if(className != 'active') {
+ return;
+ }
+ element.css({
+ position: 'absolute',
+ left: 0,
+ top: 0
+ });
+
+ jQuery(element).animate({
+ top: -500
+ }, done);
+
+ return function(cancel) {
+ if(cancel) {
+ element.stop();
+ }
+ };
+ }
+
+ return {
+ addClass: animateUp,
+ removeClass: animateDown
+ };
+});
</pre>
Note that we're using {@link http://jquery.com/ jQuery} to implement the animation. jQuery