Push Menu Not Functioning


#1

I'm not quite sure what I have done wrong.. My code has been accepted to pass the lesson, however, my Push Menu doesn't move. I just wanted to see if you guys you could catch my mistakes! If it doesn't work, something has to be wrong!

Here's me code:

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);
};

$(document).ready(main);

Thanks in advance!!


#2

Hi Apexaustin,

Your main problem is right here:

The first semi-colon (;) should be a comma (,), and you make that mistake several times.

The second thing is this:

Since .body selects an element with the class="body" attribute, and there isn't any element like that on the page, nothing is going to happen there. You need to change it to $('body'), so it selects the <body> element :slightly_smiling:


#3

Thanks for the help!

I made the changes, the code still passes, but the menu still won't function properly. I'm farther along into the course now, but I'm determined to solve this issue!

Any other suggestions?

My revised code:

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);

};

$(document).ready(main);


#4

@apexaustin You need to close what you open on line 11, on line 18 :slightly_smiling:
Also, you'll probably need to refresh the page. I spent about fifteen minutes trying to find the other problem, and there was none - evidently the error-checker wasn't updating properly :slightly_smiling:


#5

You're the man! I really appreciate your help.

Thanks zystvan!