Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 7cf5544

Browse files
matthewhintzenIgorMinar
authored andcommitted
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
1 parent 030a9b8 commit 7cf5544

File tree

1 file changed

+50
-37
lines changed

1 file changed

+50
-37
lines changed

docs/content/tutorial/step_12.ngdoc

Lines changed: 50 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -340,45 +340,58 @@ Although we could do that, let's take the opportunity to learn how to create Jav
340340

341341
__`app/js/animations.js`.__
342342
<pre>
343-
angular.module('phonecatAnimations', ['ngAnimate'])
344-
345-
.animation('.phone', function() {
346-
return {
347-
addClass : function(element, className, done) {
348-
if(className != 'active') {
349-
return;
350-
}
351-
element.css({
352-
position: 'absolute',
353-
top: 500,
354-
left: 0,
355-
display: 'block'
356-
});
357-
jQuery(element).animate({
358-
top: 0
359-
}, done);
360-
361-
return function(cancel) {
362-
if(cancel) element.stop();
363-
};
364-
},
365-
removeClass : function(element, className, done) {
366-
if(className != 'active') return;
367-
element.css({
368-
position: 'absolute',
369-
left: 0,
370-
top: 0
371-
});
372-
jQuery(element).animate({
373-
top: -500
374-
}, done);
375-
376-
return function(cancel) {
377-
if(cancel) element.stop();
378-
};
343+
var phonecatAnimations = angular.module('phonecatAnimations', ['ngAnimate']);
344+
345+
phonecatAnimations.animation('.phone', function() {
346+
347+
var animateUp = function(element, className, done) {
348+
if(className != 'active') {
349+
return;
350+
}
351+
element.css({
352+
position: 'absolute',
353+
top: 500,
354+
left: 0,
355+
display: 'block'
356+
});
357+
358+
jQuery(element).animate({
359+
top: 0
360+
}, done);
361+
362+
return function(cancel) {
363+
if(cancel) {
364+
element.stop();
379365
}
380366
};
381-
});
367+
}
368+
369+
var animateDown = function(element, className, done) {
370+
if(className != 'active') {
371+
return;
372+
}
373+
element.css({
374+
position: 'absolute',
375+
left: 0,
376+
top: 0
377+
});
378+
379+
jQuery(element).animate({
380+
top: -500
381+
}, done);
382+
383+
return function(cancel) {
384+
if(cancel) {
385+
element.stop();
386+
}
387+
};
388+
}
389+
390+
return {
391+
addClass: animateUp,
392+
removeClass: animateDown
393+
};
394+
});
382395
</pre>
383396

384397
Note that we're using {@link http://jquery.com/ jQuery} to implement the animation. jQuery

0 commit comments

Comments
 (0)