Push Menu: Close the menu


#1



https://www.codecademy.com/courses/web-beginner-en-zmn0b/0/7?content_from=make-an-interactive-website%3Ayour-first-program#


Error message is Oops, try again. Use the line $('.icon-close').click(); inside your main function.
But I thing this code is correct to my view. And can't understand why generating this message.


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

        $('body').animate({
            left: '285px'
            }, 200);
    });
    
    $(".icon-close").click(function(){
        $(".menu").animate({
            left:"-285px"
                },200);
            
        $("body").animate({
            left:"0px"
            },200);
        });
};


#2

@r.kalai
Try using the single-quote-' '
as is mentioned in the Oops-message $('.icon-close').click();
instead of you using double-quotes-" "
$(".icon-close").click();

In normal life, both are correct
for the code-checker only the single-quote's


#3

Then I tried your method but it not working.


#4

@r.kalai,
You do have
$(document).ready(main);
as very last line of your code ??


#5

Wow thank you..
Now it's working after used $(document).ready(main);:innocent:
Tell me it's important to use $(document).ready(main); method.???


#6

@r.kalai
With google search
== the Book ==
ready() site:jquery.com
https://learn.jquery.com/using-jquery-core/document-ready/

load() site:jquery.com
https://api.jquery.com/load-event/

==================================================================

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 ==
www.crockford.com
[your question] site:crockford.com
- - http://javascript.crockford.com/code.html << Javascript coding convention
- - http://javascript.crockford.com/survey.html

http://stackoverflow.com/questions/1795438/load-and-execution-sequence-of-a-web-page
http://www.w3schools.com/jquery/trysel.asp
http://www.w3schools.com/jquery/jquery_ref_selectors.asp
++ bootstrap
http://getbootstrap.com/getting-started/
http://getbootstrap.com/2.3.2/components.html
We now have .col-xs (phones), .col-sm (tablets), .col-md (desktops), and .col-lg (large desktops).


#7

Thank you very much leonhard.. for send those useful link and informations.
I will refer that all details.
:frowning2::tada:


#8

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