2. more practive with .animate()


#1


https://www.codecademy.com/courses/web-beginner-en-jtFIC/0/2?curriculum_id=50a3fad8c7a770b5fd0007a1#


error message keep saying to make sure I add px to 100 because it doesnt move


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


#2

Looks good. Try to refresh page.


#3

i tried that and reset the code and restarted my computer


#4

$(document).ready(function(){
$('img').animate({top:'+=100px'},'1000');
});
this was my code and it worked fine for me. check you timing looks like its missing these ' '


#5

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

This is my code and yeah works absolutely fine. You don't need to add px. Just leave it as 100 ({top: '+=100'})


#6

@tagjumper12193, your code worked, to pass this section.

I wrote it to work on keypress, but not what they wanted, which does work: ...

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

#7

Got it working my code was right idk why it just started working maybe my cache was clean out


#8

I kept getting a syntax error (before I even entered any code). I just erased the code they had already written and started from scratch. worked fine.


#9

seem to be having the exact same problem, syntax problems before i've even started, i'll try your recommendation!


#10

Did it work? (typing more to meet 20 character limit...please ignore)


#11

Yes it did! Legendary, cheers for the tip. Much appreciated


#12

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.