Bug in 2/14!


#1

Hello!
The default code that is set up for 2.More Practice with .animate(), is flawed. There is a curly bracket after 500 instead of after '-='.

So instead of:
$( ).animate({ top: '-=', 500 });
it should be
$( ).animate({ top: '-='}, 500);

Just in case anyone gets stuck.


#2

@kimmyk90,
Then in your corrected-code remove the second closing-curly-bracket-}


#3

@leonhard_wettengmx_n

Thank you. How embarrassing! XD


#4

Another problem I found is they started us with the wrong operation. You need to make -= into += to complete this.
When you run it after you apply that correction you will get an error that say's that top counter should be increasing.


#5

O ya, I had to make the thing increase not decrease


#6

Here is my code:
$(document).ready(function(){
// Fill in the blanks!
$('img').animate({ top: '+= 100px' , 1000});
});
});
It rells me it should be increasing not decreasing


#7

problem area:

i've pointed to the areas that need corrected...


your code:

$('img').animate({top: += 100px', 1000});
                       
                       ^              ^

needs to be:

$('div').animate({top: -= 100px'}, 1000);

                       ^        ^

your code should like this now:

$(document).ready(function() {
    $('img').animate({top:'+=100px'},1000);
});

hope this helps :)


#8

which is ridiculous, as they tell us the opposite in the instructions.


#9

It still doesn't work for me, even though code should be correct.

$(document).ready(function() {
    // Fill in the blanks!
    $('img').animate({top:'+= 100px'},1000);
});

#10

ok, I had unnecessary space after +=


#12