2.More practice with animate() (bug? or me being dumb?)


#1


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


Hey guys i have a problem my code i think is correct but i dont understand whats wrong?
I looked at other posts about their code not working but when i try the solutions they dont work.The Elevator doesnt move and i get this:

"Oops, try again. Please follow the instructions on the Full Preview page to test your code."

All help is appreciated :smile:

(sorry if i reply late i am always doing things and i dont have time to check every hour,minutes etc)

Code:

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


#2

Hello!

Tell me please where did you found your div in index.html?

This is index.html:

<!DOCTYPE html>
<html>
    <head>
		<title>Going Down</title>
        <link rel='stylesheet' type='text/css' href='stylesheet.css'/>
        <script type='text/javascript' src='script.js'></script>
	</head>
	<body>
        <img src="http://i1061.photobucket.com/albums/t480/ericqweinstein/elevator.png"/>   
	</body>
</html>

... and this is yours script.js:

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

You have to animate your image like this:

$(document).ready(function(){

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

... and than everything will work fine! :wink:


#3

Thanks man, i dont know why i wrote 'div' i guess i was dumb :stuck_out_tongue_winking_eye:
your method worked thanks!


#4

thanks for make me laughing :smile:


#5

A post was split to a new topic: 2. More Practice with .animate()


#6