Unit 1, Lesson 5: Menu won't appear, whatever I do!


Hey guys!

I'm a pretty new Codecademy user (and really enjoy it :slightly_smiling: ).

My Problem:
I'm currently doing the 5th lesson of the 1st unit on how to make an interactive website. I tried to make the menu appear for about 1 and half an hour. First I did it on my own, then I tried to get help by the "Get a hint" feature. But: Even when I copy + paste the code from the hint, I still get the error "Oops, try again. It looks like the '.menu' didn't animate into the screen. Check your $('.menu').animate() function."

My code
I didnt change anything in the CSS or HTML, so here's my JS code:

var main = function() {
  $('.icon-menu').click(function() {
      left: '0px'
    }, 200);

      left: '285px'
    }, 200);

And also if I click on the Menu in the preview, it doesn't show up anything...

Thank you all for your help!

Skyflyer :smiley:


With the code presented in your Post
you assign a so-called anonymous function to the variable main.

As the Browser loads the HTML-Document
the =main= function is distributed in memory but NOT executed.....

You could use jQuery's ready() facility

$(document).ready( main );

which will execute the =main= function as soon as the jQuery-ready-flag has been set.....

google search
== the Book ==
jquery [your question] site:developer.mozilla.org
CSS [your question] site:developer.mozilla.org
javascript [your question] site:developer.mozilla.org
[your question] site:jquery.com
[your question] site:getbootstrap.com

== discussions / opinions ==
jquery [your question] site:stackoverflow.com
CSS [your question] site:stackoverflow.com
javascript [your question] site:stackoverflow.com

== guidance ==
[your question] site:crockford.com
- - http://javascript.crockford.com/code.html
- - http://javascript.crockford.com/survey.html



Thank you very much sir!!! Very happy at the moment... Thanks ;D